This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12395] Suboptimal code with global variables
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Sep 2003 19:38:40 -0000
- Subject: [Bug optimization/12395] Suboptimal code with global variables
- References: <20030924231750.12395.steven@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.