optimization/10837: noreturn attribute causes no sibling calling optimization

[email protected]
Newsgroups gmane.comp.gcc.prs
Message-ID <[email protected]>
>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:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.