This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/51900] [4.6 Regression] const variable initialization always zero


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51900

--- Comment #5 from Daniel Starke <daniel.f.starke at freenet dot de> 2012-01-19 14:51:33 UTC ---
Compiling it with
gcc -static -fcommon -o main.o -c main.c
gcc -static -fcommon -o a.o -c a.c
gcc -static -o main.exe main.o a.o
results in
$ ./main
myVar[0] = 5
myVar[1] = 6
myVar[2] = 7

Compiling it with
gcc -static -O2 -fcommon -o main.o -c main.c
gcc -static -O2 -fcommon -o a.o -c a.c
gcc -static -o main.exe main.o a.o
results in
$ ./main
myVar[0] = 0
myVar[1] = 0
myVar[2] = 0

Thus a different option causes this change.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]