[Bug c/126948] New: Error on goto label after pragma directive in if statement
"eczbek.void at gmail dot com via Gcc-bugs" <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126948
Bug ID: 126948
Summary: Error on goto label after pragma directive in if
statement
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: eczbek.void at gmail dot com
Target Milestone: ---
https://godbolt.org/z/Mf7EsooeY
This seems to happen with some pragmas, like diagnostic and coverage, but not
others.
```
int main() {
if (0)
#pragma message ""
label:;
}
```
```
<source>: In function 'main':
<source>:4:17: error: 'label' undeclared (first use in this function)
4 | label:;
| ^~~~~
<source>:4:17: note: each undeclared identifier is reported only once for each
function it appears in
<source>:4:22: error: expected ';' before ':' token
4 | label:;
| ^
| ;
```