| Issue |
56040
|
| Summary |
Clang C compiler does not support declarations after a label
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ramonpantin
|
/*
$ clang --version
Debian clang version 13.0.1-3+build2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang -c -std=c17 clang-label-bug.c
clang-label-bug.c:5:8: error: expected _expression_
retry: int r = bar();
^
clang-label-bug.c:6:7: error: use of undeclared identifier 'r'
if (!r) goto retry;
^
clang-label-bug.c:7:9: error: use of undeclared identifier 'r'
return r;
^
3 errors generated.
$ clang -DWORK_AROUND -c -std=c17 clang-label-bug.c
$
*/
#ifndef WORK_AROUND
int bar();
int foo(int a) {
retry: int r = bar();
if (!r) goto retry;
return r;
}
#else
int bar();
int foo(int a) {
retry:; int r = bar(); /* Clang needs the extra ; after the retry: */
if (!r) goto retry;
return r;
}
#endif
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs