optimization/10837: noreturn attribute causes no sibling calling optimization

pinskia@physics.uc.edu pinskia@physics.uc.edu
Sat May 17 18:59:00 GMT 2003


>Number:         10837
>Category:       optimization
>Synopsis:       noreturn attribute causes no sibling calling optimization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 17 17:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Pinski
>Release:        GNU C version 3.4 20030516 and GNU C version 3.4 20030517
>Organization:
>Environment:
powerpc-apple-darwin6.6 and i686-pc-linux-gnu
>Description:
noreturn attribute on a function causes sibling calling optimization not to be able to be done, so it causes more code to be executed then needed.
>How-To-Repeat:
cat >tt.c <<EOF
void temp()
{
                abort();
}

void temp2() __attribute__((__noreturn__));
void temp1()
{
        temp2();
}

void temp3();

void temp4()
{
        temp3();
}
EOF
gcc -O3 -fomit-frame-pointer tt.c -S
look at the asm and see that temp4 has the optimization but temp1 does not.
>Fix:
if the attrubute is on a function, act like it is a return statement also, so that the sibiling call optimization will always work with that one.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list