This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11304] New: Wrong code production with -fomit-frame-pointer
- From: "manuel dot serrano at sophia dot inria dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jun 2003 07:22:21 -0000
- Subject: [Bug c/11304] New: Wrong code production with -fomit-frame-pointer
- 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=11304
Summary: Wrong code production with -fomit-frame-pointer
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: manuel dot serrano at sophia dot inria dot fr
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: Linux owens.inria.fr 2.4.21
GCC target triplet: i386
I have found a problem with GCC3.2 and GCC3.3 when -fomit-frame-pointer
and -O2 are both used. The bug seems to be concerning the registers allocation
that seems erroneous. The problem does not exist with GCC2.95. It goes away
if either -fomit-frame-pointer or -O2 are disabled.
*** Operating system:
=====================
$ uname -a
Linux owens.inria.fr 2.4.21 #1 Tue Jun 17 16:26:21 CEST 2003 i686 GNU/Linux
*** GCC version:
================
gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.3 (Debian)
*** Source code:
================
int hux(int x){
if(x){
foo( 4 );
return x;
}
failure_then_exit(x);
}
*** GCC Command line:
=====================
gcc -O2 -fomit-frame-pointer foo.c
*** Preprocessed source file:
=============================
$ gcc -fomit-frame-pointer foo.c -S -O2 -save-temps
$ cat foo.i
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.c"
int hux(int x)
{
if(x)
{
foo( 4 );
return x;
}
failure_then_exit(x);
}
*** Assembly file (that I known you don't want bug that shows the bug):
=======================================================================
$ cat foo.s
.file "foo.c"
.text
.p2align 2,,3
.globl hux
.type hux, @function
hux:
pushl %ebx
subl $8, %esp
movl 16(%esp), %ebx
testl %ebx, %ebx
je .L2
subl $12, %esp
pushl $4
call foo # <-- HERE, THE REGISTER EAX IS NOT
.L3: # RELOADED !!!
addl $24, %esp
popl %ebx
ret
.p2align 2,,3
.L2:
subl $12, %esp
pushl $0
call failure_then_exit
jmp .L3
.size hux, .-hux
.ident "GCC: (GNU) 3.3 (Debian)"