------- Comment #3 from reza dot yazdani at amd dot com 2010-02-05 21:10 ------- "The optimization performed is correct because:
In C++ (not in C) a const modifier in a global variable has internal linkage (i.e. it is treated like a static variable) and therefore the optimization performed is correct. A global const variable can have legally different values in different files. In C, it is illegal to initialize a global variable in more than one location, and if initialized in more than one place all values must be the same, because its initial value is nondeterministic if different. This bug is unrelated to PIC, it will behave the same, if the program is written according to the C/C++ standards." I suggest to be closed and marked as user error. -- reza dot yazdani at amd dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |reza dot yazdani at amd dot | |com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30153