c/10231: Request a "reachable" attribute for labels.
archie@dellroad.org
archie@dellroad.org
Wed Mar 26 21:56:00 GMT 2003
>Number: 10231
>Category: c
>Synopsis: Request a "reachable" attribute for labels.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Mar 26 21:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: "Archie Cobbs" <archie@dellroad.org>
>Release: 2.95.4
>Organization:
>Environment:
FreeBSD 4.8
>Description:
Consider this code:
foo()
{
goto lable3;
label2:
printf("don't eliminate me\n");
label3:
printf("ok I'm here now\n");
}
When optimizing -O2 GCC will eliminate the code between
label2 and label3. However I have an application where
I need this code to remain, because I've made the address
of label2 available (via "&&label2") and also have some
asm() statements that are used to jump to label2 that
GCC doesn't know about.
The only way to force GCC to keep the code is to do
add reachable code that does something like this:
if (non-constant expression that's never true)
goto label2;
This is a wasteful and ugly kludge though. It would be
nicer if you could simply add a "reachable" attribute to
a label that would tell GCC the label is reachable even
if GCC thinks otherwise. So the example would become:
foo()
{
goto lable3;
label2 __attribute__ ((reachable)):
printf("don't eliminate me\n");
label3:
printf("ok I'm here now\n");
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list