[Bug optimization/12395] Suboptimal code with global variables
steven at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Sep 25 20:00:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12395
------- Additional Comments From steven at gcc dot gnu dot org 2003-09-25 19:38 -------
Well I don't _know_ for sure if it is related to global variabes, but it sure
seems so:
void foo(int a) {
if(++a) ++a;
printf ("%d",a);
}
.file "t.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d"
.text
.globl foo
.type foo,@function
foo:
movl 4(%esp), %eax
incl %eax
je .L2
incl %eax
.L2:
pushl %eax
pushl $.LC0
call printf
popl %eax
popl %edx
ret
.Lfe1:
.size foo,.Lfe1-foo
.ident "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
void foo() {
int a
if(++a) ++a;
printf ("%d",a);
}
produces something similar.
More information about the Gcc-bugs
mailing list