public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: middle-end/7736: gcc destroys stack layout when a local label is used
@ 2003-03-25 18:30 neroden
  0 siblings, 0 replies; 3+ messages in thread
From: neroden @ 2003-03-25 18:30 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, piotr.wyderski

Synopsis: gcc destroys stack layout when a local label is used

State-Changed-From-To: feedback->closed
State-Changed-By: neroden
State-Changed-When: Tue Mar 25 18:29:38 2003
State-Changed-Why:
    Not clear that there's a bug.  No feedback 3 months.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7736


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: middle-end/7736: gcc destroys stack layout when a local label is used
@ 2002-12-20 21:39 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2002-12-20 21:39 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, piotr.wyderski

Synopsis: gcc destroys stack layout when a local label is used

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Fri Dec 20 21:39:15 2002
State-Changed-Why:
    I can't see what is wrong with the function for which you
    show the assembler output: you have an infinite loop, and
    the assembler code reflects that. What exactly is it that
    you consider a problem in this code snippet?
    If the problem does only appear in larger functions than
    the one you present, you will have to give us an example
    of such a function.
    
    Regards
      Wolfgang
    
    PS: Just for the record -- all more recent versions of
    gcc create virtually the same code.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7736


^ permalink raw reply	[flat|nested] 3+ messages in thread

* middle-end/7736: gcc destroys stack layout when a local label is used
@ 2002-08-27 13:36 piotr.wyderski
  0 siblings, 0 replies; 3+ messages in thread
From: piotr.wyderski @ 2002-08-27 13:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7736
>Category:       middle-end
>Synopsis:       gcc destroys stack layout when a local label is used
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 27 10:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Piotr Wyderski
>Release:        3.0, 3.0.1, 3.0.4 (supposably all versions)
>Organization:
>Environment:
IA-32 Celeron, Red Hat Linux 7.2.
>Description:
When a local label is used in a function, gcc generates
broken code. The simplest example is:

void test(void) {
    ({ __label__ x;
    x:
    goto x;
    });
}

gcc -S -O2 1.c, which produces:

.file "1.c"
.text
.align 16
.globl test
.type test,@function
test:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
.L2:
jmp .L2
.Lfe1:
.size test,.Lfe1-test
.ident "GCC: (GNU) 3.0.4"

The error is because of "subl $8,%esp". This is NOT an alignment issue,
because sometimes (when a function is slightly larger) it produces things
like:

    push edx
    push edx
    // very small function body here, which _doesn't_ use edx nor ecx.
    pop   ecx
    pop   eax
    ret

There's no such an error when a global (i.e. normal) label is used
instead, code is generated properly. I've tested that on many ways
and I am completely sure this wrong behaviour is because of local
labels. When the function code is quite large, it causes a crash of
the application, thus this bug is critical.
>How-To-Repeat:
Use a local label in a (small) function and read assembly output.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-25 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-25 18:30 middle-end/7736: gcc destroys stack layout when a local label is used neroden
  -- strict thread matches above, loose matches on Subject: below --
2002-12-20 21:39 bangerth
2002-08-27 13:36 piotr.wyderski

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).