bug found in gcc 3.2
Wolfgang Bangerth
bangerth@ices.utexas.edu
Wed Apr 16 23:33:00 GMT 2003
Alan,
this is not a bug in gcc. You are playing type games with pointers of type
long* to long long variables. The language standard prohibits this [1]. If
you absolutely have to do things like that, either use -fno-strict-aliasing
(which makes the program behave in the way you want), or use the
suggestions mentioned in the manual (look for "aliasing"). The manual
lists a number of ways to modify code to make it standard conforming.
Regards
Wolfgang
[1] In short: the standard says that variables must only be accessed
through pointers to their exact type (up to some exceptions for char*).
All other pointer operations are assume not to change the value of that
variable -- which in your case tricks the compiler into exchanging
statements it thinks are independent, and possibly optimizing them away at
all.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
More information about the Gcc-bugs
mailing list