http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58244
Bug ID: 58244 Summary: global variable: many THOUSANDS times slower execution Product: gcc Version: 4.7.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: martin.konopka at stuba dot sk Created attachment 30701 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30701&action=edit sample C code to demonstrate the performance issue * I have a very small sample code written in pure C. * I am using 64-bit linux: - Linux Mint Maya with gcc 4.6.3 (gcc and libraries same as ubuntu 12.04 LTS) - ubuntu 12.10 with gcc 4.7.2 - newest Scientific Linux with compilers 4.4.7 and 4.7.3 When I declare a simple variable (auxvar , see the code) as a local one, then the executable is about as fast as it should be. When I declare the variable as a global one, then the executable becomes insanely slow. The behaviour is the same for any of the above mentioned linuxes and compiler versions. Please see attached C code. Compile it using gcc -O2 -Wall slowcode.c -lm Please do NOT declare auxvar both globally and locally. Use either local or global declaration. Thanks.