[Cfp-interest] Compound statement exit complications
Ian McIntosh
ianm at ca.ibm.com
Tue May 13 10:52:22 PDT 2014
I agree that the new pragmas we're discussing should apply to compound
statements (C lexical blocks). There are sometimes complications.
Straightforward:
{
#pragma STDC FENV_ROUND FE_TOWARD_ZERO
. . .
} /* pragma's effect ends here */
A little trickier:
{
#pragma STDC FENV_ROUND FE_TOWARD_ZERO
. . .
if (condition) goto label1; /* pragma's effect ends if the goto is
executed */
. . .
} /* pragma's effect ends here */
. . .
label1:
In that case the compiler has to observe that Label1 is outside the
compound statement affected by the pragma, and turn off the pragma's effect
both when exiting through the bottom of the compound statement and also
when exiting in the middle via a goto or equivalent.
A lot trickier, using gcc / IBM xlc label variables:
void* label_variable;
{
#pragma STDC FENV_ROUND FE_TOWARD_ZERO
. . .
if (condition) label_variable = label2;
else label_variable = label3;
. . .
if (condition) goto label_variable; /* pragma's effect MIGHT OR
MIGHT NOT end if the goto is executed, depending on where it goes to */
. . .
label2: /* if label_variable points here, goto leaves the pragma in
effect */
. . .
} /* pragma's effect ends here */
. . .
label3: /* if label_variable points here, goto ends the pragma's effect
*/
- Ian McIntosh IBM Canada Lab Compiler Back End Support
and Development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20140513/e5c7c928/attachment.html
More information about the Cfp-interest
mailing list