public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/3323: gcc -O2 -fomit-frame-pointer -fPIC references unitialized %ebp on x86
@ 2002-04-02 2:04 rth
0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-04-02 2:04 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, mitr, mkoerner, user42, rodrigc, nobody
Synopsis: gcc -O2 -fomit-frame-pointer -fPIC references unitialized %ebp on x86
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr 2 02:04:34 2002
State-Changed-Why:
Fixed for gcc 3.0.4.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3323
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: optimization/3323: gcc -O2 -fomit-frame-pointer -fPIC references unitialized %ebp on x86
@ 2002-01-13 17:06 Craig Rodrigues
0 siblings, 0 replies; 3+ messages in thread
From: Craig Rodrigues @ 2002-01-13 17:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/3323; it has been noted by GNATS.
From: Craig Rodrigues <rodrigc@mediaone.net>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, mkoerner@itp.phys.ethz.ch,
user42@zip.com.au, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, mitr@volny.cz
Cc:
Subject: Re: optimization/3323: gcc -O2 -fomit-frame-pointer -fPIC references
unitialized %ebp on x86
Date: Sun, 13 Jan 2002 20:00:48 -0500
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3323
Duplicates of this bug:
PR 3959
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3959
PR 5370
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5370
--
Craig Rodrigues
http://www.gis.net/~craigr
rodrigc@mediaone.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* optimization/3323: gcc -O2 -fomit-frame-pointer -fPIC references unitialized %ebp on x86
@ 2001-06-21 3:36 mitr
0 siblings, 0 replies; 3+ messages in thread
From: mitr @ 2001-06-21 3:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 3323
>Category: optimization
>Synopsis: gcc -O2 -fomit-frame-pointer -fPIC references unitialized %ebp on x86
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Jun 21 03:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Miloslav Trmac
>Release: 3.0
>Organization:
NA
>Environment:
System: Linux linux.localdomain 2.4.2-2 #1 Sun Apr 8 19:37:14 EDT 2001 i586 unknown
Architecture: i586
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ../gcc-3.0/configure
>Description:
The enclosed file, when compiled with -g -O2 -fomit-frame-pointer -fPIC,
results in fillgrent starting with
pushl %ebp
leal 8(%ebp), %eax
It seems the compiler can't "decide" whether it uses %ebp as frame pointer or
as a general register. Omitting either -fomit-frame-pointer or -fPIC
seems to make the problem go away.
The called function do_field () must be static, so that fillgrent doesn't
need %ebx pointing to the GOT. The example has been simplified as much as
possible, so don't try to figure what it should actually do :-)
Nevertheless I'm sure at the function calls should be generated correctly,
AFAICS the code is strictly conforming C.
>How-To-Repeat:
------------------------File grp.i
struct group
{
const char *gr_name;
int gr_gid;
const char *src;
const char **gr_mem;
};
static void
do_field (const char **_FIELD, void **_MEM)
{
}
void
fillgrent (struct group *_GROUP, void *_MEM)
{
const char *tmp;
const char **cm;
do_field (&_GROUP->gr_name, &_MEM);
cm = _MEM;
tmp = _GROUP->src;
_GROUP->gr_mem = cm;
for (;;)
{
*cm = tmp;
do_field (cm, &_MEM);
}
}
-----------------------Result of gcc -g -O2 -fomit-frame-pointer -fPIC grp.i -S
.file "grp.i"
.stabs "/home/mirek/",100,0,0,.Ltext0
.stabs "grp.i",100,0,0,.Ltext0
.text
.Ltext0:
.stabs "gcc2_compiled.",60,0,0,0
.stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",128,0,0,0
.stabs "char:t(0,2)=r(0,2);0;127;",128,0,0,0
.stabs "long int:t(0,3)=r(0,3);-2147483648;2147483647;",128,0,0,0
.stabs "unsigned int:t(0,4)=r(0,4);0000000000000;0037777777777;",128,0,0,0
.stabs "long unsigned int:t(0,5)=r(0,5);0000000000000;0037777777777;",128,0,0,0
.stabs "long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,0
.stabs "long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;",128,0,0,0
.stabs "short int:t(0,8)=@s16;r(0,8);-32768;32767;",128,0,0,0
.stabs "short unsigned int:t(0,9)=@s16;r(0,9);0;65535;",128,0,0,0
.stabs "signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
.stabs "unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
.stabs "float:t(0,12)=r(0,1);4;0;",128,0,0,0
.stabs "double:t(0,13)=r(0,1);8;0;",128,0,0,0
.stabs "long double:t(0,14)=r(0,1);12;0;",128,0,0,0
.stabs "complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;",128,0,0,0
.stabs "complex float:t(0,16)=r(0,16);8;0;",128,0,0,0
.stabs "complex double:t(0,17)=r(0,17);16;0;",128,0,0,0
.stabs "complex long double:t(0,18)=r(0,18);24;0;",128,0,0,0
.stabs "__builtin_va_list:t(0,19)=*(0,20)=(0,20)",128,0,0,0
.stabs "_Bool:t(0,21)=@s8;-16;",128,0,0,0
.stabs "group:T(0,22)=s16gr_name:(0,23)=*(0,2),0,32;gr_gid:(0,1),32,32;src:(0,23),64,32;gr_mem:(0,24)=*(0,23),96,32;;",128,0,0,0
.align 16
.stabs "do_field:f(0,20)",36,0,10,do_field
.stabs "_FIELD:p(0,24)",160,0,9,4
.stabs "_MEM:p(0,25)=*(0,26)=*(0,20)",160,0,9,8
.type do_field,@function
do_field:
.stabn 68,0,10,.LM1-do_field
.LM1:
.stabn 68,0,11,.LM2-do_field
.LM2:
ret
.Lfe1:
.size do_field,.Lfe1-do_field
.Lscope0:
.stabs "",36,0,0,.Lscope0-do_field
.align 16
.stabs "fillgrent:F(0,20)",36,0,14,fillgrent
.stabs "_GROUP:p(0,27)=*(0,22)",160,0,13,4
.stabs "_MEM:p(0,26)",160,0,13,8
.globl fillgrent
.type fillgrent,@function
fillgrent:
.stabn 68,0,14,.LM3-fillgrent
.LM3:
.LBB2:
pushl %ebp
.stabn 68,0,17,.LM4-fillgrent
.LM4:
leal 8(%ebp), %eax
.stabn 68,0,14,.LM5-fillgrent
.LM5:
pushl %edi
pushl %esi
movl 4(%ebp), %esi
movl 8(%ebp), %edi
.stabn 68,0,17,.LM6-fillgrent
.LM6:
pushl %edx
pushl %edx
pushl %eax
pushl %esi
call do_field
addl $16, %esp
.stabn 68,0,19,.LM7-fillgrent
.LM7:
movl 8(%esi), %ebp
.stabn 68,0,20,.LM8-fillgrent
.LM8:
movl %edi, 12(%esi)
.p2align 4,,7
.L3:
.stabn 68,0,23,.LM9-fillgrent
.LM9:
movl %ebp, (%edi)
.stabn 68,0,24,.LM10-fillgrent
.LM10:
pushl %eax
pushl %eax
leal 8(%ebp), %eax
pushl %eax
pushl %edi
call do_field
addl $16, %esp
.stabn 68,0,21,.LM11-fillgrent
.LM11:
jmp .L3
.LBE2:
.Lfe2:
.size fillgrent,.Lfe2-fillgrent
.stabs "_GROUP:r(0,27)",64,0,13,6
.stabs "tmp:r(0,23)",64,0,15,5
.stabs "cm:r(0,24)",64,0,16,7
.stabn 192,0,0,.LBB2-fillgrent
.stabn 224,0,0,.LBE2-fillgrent
.Lscope1:
.stabs "",36,0,0,.Lscope1-fillgrent
.text
.stabs "",100,0,0,.Letext
.Letext:
.ident "GCC: (GNU) 3.0"
-------------------------------------------------------------------------------
>Fix:
Omitting -fomit-frame-pointer seems to sidestep the problem.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-02 10:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02 2:04 optimization/3323: gcc -O2 -fomit-frame-pointer -fPIC references unitialized %ebp on x86 rth
-- strict thread matches above, loose matches on Subject: below --
2002-01-13 17:06 Craig Rodrigues
2001-06-21 3:36 mitr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).