------- Comment #2 from sergei_lus at yahoo dot com 2009-08-17 16:35 -------
First of all, I agree that a union would work better for type-punning, but... With all the respect I am not convinced that this is the case here. Even if I do something like this: tmp_ch = (char *)&ans; tmp_sh = (unsigned short *)tmp_ch; I would expect tmp_ch to be "aliased to everything", and it should in turn also hold for tmp_sh... unless you can say which standard (C99) rule says otherwise. ... but this argument aside, maybe you can explain why up to 4.3.2 GCC was "ok" with this code, and 4.4.0 explicitly changed its behavior - I could not readily track it down (could be my inability to trace it back). In a similar fashion I would appreciate a justification (C99 reference). Also, in 4.4.0 forwprop1 turns this: tmp_ch_10 = (char *) &ans; tmp_sh_11 = (short unsigned int *) tmp_ch_10; into this: tmp_sh_11 = (short unsigned int *) &ans; ...so alias analyzer does not even "see" the (char *) cast... 4.3.2 does not do this. The actual issue is that this breaks a long standing legacy code (a math library) and I see no provision to disable this new "feature" short of turning off strict aliasing all together. Thank you for your response - and information is very much appreciated. -- sergei_lus at yahoo dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|DUPLICATE | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41072