[cfp-interest 3944] FW: [SC22WG14.36658] New issue #1068: Standard pragmas after labels
RAJAN BHAKTA
rbhakta at us.ibm.com
Wed May 27 18:02:22 PDT 2026
Of interest to our group. No action item, but we can discuss this in our next meeting.
Regards,
Rajan Bhakta
From: owner-sc22wg14 at open-std.org <owner-sc22wg14 at open-std.org> on behalf of Joseph Myers <josmyers at redhat.com>
Date: Wednesday, May 27, 2026 at 3:52 PM
To: sc22wg14 at open-std.org <sc22wg14 at open-std.org>
Subject: [EXTERNAL] [SC22WG14.36658] New issue #1068: Standard pragmas after labels
The following new C standard issue has been submitted.
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.open-2Dstd.org_jtc1_sc22_wg14_issues_c23_issue1068.html&d=DwICAg&c=BSDicqBQBDjDI9RkVyTcHQ&r=XTIN0AwPKAf2bIKNxlzdeqggAytE5h-JEusWpx9MXwc&m=35Bk5l4rx7pSHwBUqOddVThAFFxy6mEgbFYTkWqCumL2_M6NqaSn5299_ozypcE2&s=6rrbfTvBW9Th6HESFWpuLZ4stHBTlYk6DRBqom_IzvE&e=
## Issue 1068: Standard pragmas after labels
Authors: Jay Ghiron
Date: 2026-05-27
Submitted against: C23
Status: Open
All of the standard pragmas contain wording to require use in specific
contexts:
> The pragma can occur either outside external declarations or
> preceding all explicit declarations and statements inside a compound
> statement.
(C23 7.3.4 "The `CX_LIMITED_RANGE` pragma" paragraph 2.)
> The pragma shall occur either outside external declarations or
> preceding all explicit declarations and statements inside a compound
> statement.
(C23 7.6.2 "The `FENV_ACCESS` pragma" paragraph 2.)
> The pragma shall occur either outside external declarations or
> before all explicit declarations and statements inside a compound
> statement.
(C23 7.6.3 "The `FENV_ROUND` pragma" paragraph 2.)
> Each pragma can occur either outside external declarations or
> preceding all explicit declarations and statements inside a compound
> statement.
(C23 7.12.3 "The `FP_CONTRACT` pragma" paragraph 2.)
Before C23, "all explicit declarations and statements" meant that
nothing could be used before these pragmas in a compound statement.
In C23 the definition of block items in a compound statement was
changed so that labels can be used at the end of a block without any
following statement, and can be used preceding a declaration
([N2508](https://urldefense.proofpoint.com/v2/url?u=https-3A__www.open-2Dstd.org_jtc1_sc22_wg14_www_docs_n2508.pdf&d=DwICAg&c=BSDicqBQBDjDI9RkVyTcHQ&r=XTIN0AwPKAf2bIKNxlzdeqggAytE5h-JEusWpx9MXwc&m=35Bk5l4rx7pSHwBUqOddVThAFFxy6mEgbFYTkWqCumL2_M6NqaSn5299_ozypcE2&s=iKk-ea14nhzJ_gIzHDrffcBiSLoeWGauVKBCul1uVtA&e= )).
Consequently it appears the following is now valid:
```c
int main(){
label:
#pragma STDC FENV_ACCESS OFF
}
```
While even using a null statement before is undefined. It seems
unintended to allow labels to be used like this while placing
restrictions on other block items.
### Suggested correction
Modify C23 7.3.4 paragraph 2:
> The pragma can occur either outside external declarations or
> preceding all <del>explicit declarations and
> statements</del><ins>block items</ins> inside a compound statement.
Modify C23 7.6.2 paragraph 2:
> The pragma shall occur either outside external declarations or
> preceding all <del>explicit declarations and
> statements</del><ins>block items</ins> inside a compound statement.
Modify C23 7.6.3 paragraph 2:
> The pragma shall occur either outside external declarations or
> before all <del>explicit declarations and statements</del><ins>block
> items</ins> inside a compound statement.
Modify C23 7.12.3 paragraph 2:
> Each pragma can occur either outside external declarations or
> preceding all <del>explicit declarations and
> statements</del><ins>block items</ins> inside a compound statement.
Modify C23 J.2 paragraph 1:
> The `CX_LIMITED_RANGE`, `FENV_ACCESS`<ins>, `FENV_ROUND`,
> `FENV_DEC_ROUND`</ins>, or `FP_CONTRACT` pragma is used in any
> context other than outside all external declarations or preceding
> all <del>explicit declarations and statements</del><ins>block
> items</ins> inside a compound statement (7.3.4, 7.6.2<ins>, 7.6.3,
> 7.6.4</ins>, 7.12.3).
Note: Each of the standard pragmas express these requirements
differently. Since the result is supposed to be undefined if the
requirements are not met, they should probably all use the "shall"
wording.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20260528/44243b6a/attachment.htm>
More information about the cfp-interest
mailing list