| Issue |
233294
|
| Summary |
Missing -Wc23-extensions after 4c9fd71e18f211bfe7d43ef841b429a8ef94a140
|
| Labels |
clang:diagnostics
|
| Assignees |
|
| Reporter |
nathanchance
|
I noticed that a particular instance of `-Wc23-extensions` in the Linux kernel was visible with LLVM 23 but not LLVM 24 (we don't see these warnings with LLVM prior to 22 because we use `-fms-extensions` instead of the narrower `-fms-anonymous-structs` introduced in LLVM 23), for which I bisected to https://github.com/llvm/llvm-project/commit/4c9fd71e18f211bfe7d43ef841b429a8ef94a140 as the culprit commit.
```
$ cat test.c
void foo(int *);
void bar(void)
{
int a;
foo(&a);
switch (a) {
case 0:
int b = 0;
foo(&b);
case 1:
int c = 2;
foo(&c);
}
}
# With LLVM 23.1.3
$ clang -Wall -Wextra -std=gnu11 -fsyntax-only test.c
test.c:8:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
8 | int b = 0;
| ^
test.c:11:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
11 | int c = 2;
| ^
2 warnings generated.
# With LLVM post 4c9fd71e18f211bfe7d43ef841b429a8ef94a140
$ clang -Wall -Wextra -std=gnu11 -fsyntax-only test.c
$ git bisect log
# bad: [1ae71725e3edb2bb5c5bed7f2cff9d2f22e10636] LLVMgold: Parse -plugin-opt options into LibraryOptionsContext (#233144)
# good: [6af0a79d7a4e8558e89290df56491521c6730acd] Bump version to 24.0.0git (#209473)
git bisect start '1ae71725e3edb2bb5c5bed7f2cff9d2f22e10636' 'llvmorg-24-init'
# bad: [0d4ed3cdbe004e07d441e7e2d62d1b9a13bcf07f] [InstCombine] Evaluate zext nneg as sext where possible (#212230)
git bisect bad 0d4ed3cdbe004e07d441e7e2d62d1b9a13bcf07f
# good: [7214eb03c28238b89b6ba7e6d56b67359d6cf79e] [MLIR][Mem2Reg] Add support for memref.alloca_scope (#214221)
git bisect good 7214eb03c28238b89b6ba7e6d56b67359d6cf79e
# good: [ea3bbd57e9c1c7b39311f4fa1143f1683f1e6afe] [RISCV][NFCI] Introduce Base for Pseudo Expansion Passes (#218170)
git bisect good ea3bbd57e9c1c7b39311f4fa1143f1683f1e6afe
# good: [f4a4a1dedda89cc937432193cfcab5d1e3cc9396] [flang][test] Extend coverage for procedure-valued function results (#219477)
git bisect good f4a4a1dedda89cc937432193cfcab5d1e3cc9396
# good: [baaa72f60e597919db2d119379f048ccfaf20530] [GlobalOpt] Fix crash on self-referential global (#219777)
git bisect good baaa72f60e597919db2d119379f048ccfaf20530
# bad: [c6f9cf2bf5a36e42606a684d6a0c37c005dd4bc2] [AArch64] Add Neoverse V3AE scheduling info for v264 frecpe (#219115)
git bisect bad c6f9cf2bf5a36e42606a684d6a0c37c005dd4bc2
# bad: [437f88f61b16e5564713d0058433f4b34c41bf51] [AMDGPU][SIInsertWaitcnts] Fix soft wait removal with loop-carried deps (#220357)
git bisect bad 437f88f61b16e5564713d0058433f4b34c41bf51
# good: [847eee6a93f2a57ec716a5b78ec527b9f95a64a4] Revert "[SLP]Vectorize unique scalars of splat gather nodes as separate subtrees" (#220584)
git bisect good 847eee6a93f2a57ec716a5b78ec527b9f95a64a4
# good: [54d941486fec3a81f9d8e5a595947d540eace85c] [lldb] Add generic address space support (#214089)
git bisect good 54d941486fec3a81f9d8e5a595947d540eace85c
# bad: [f62aa8433fd3e06c60baddfe5ced6824ebfcb5a4] [NFCI] Update the directive pure-emitter to skip the switch if empty (#220255)
git bisect bad f62aa8433fd3e06c60baddfe5ced6824ebfcb5a4
# bad: [34dc057c4c095dc98cbbd0b1d16c8bf6b2e18c09] [flang][cuda] Honor component CUDA attrs in assignment copies (#220398)
git bisect bad 34dc057c4c095dc98cbbd0b1d16c8bf6b2e18c09
# bad: [89b21bed656009821f8c79128e7032fdddc6689b] [libc] Stop printing \0 in stdio/fputc_test.cpp (#220544)
git bisect bad 89b21bed656009821f8c79128e7032fdddc6689b
# bad: [3ae01af71df1ab3eb868ca15297c565568019ce8] [flang][NFC] Remove dead declarations and fix include guard (#219961)
git bisect bad 3ae01af71df1ab3eb868ca15297c565568019ce8
# bad: [4c9fd71e18f211bfe7d43ef841b429a8ef94a140] [Clang] Use Compat diagnostics for most extension/compatibility warnings (#216693)
git bisect bad 4c9fd71e18f211bfe7d43ef841b429a8ef94a140
# first 'bad' commit: [4c9fd71e18f211bfe7d43ef841b429a8ef94a140] [Clang] Use Compat diagnostics for most extension/compatibility warnings (#216693)
```
Is this expected behavior? If so, I do not mind, as this warning is kind of pointless for the kernel since GCC 11+ supports it as an extension with no warning and LLVM < 23 will not warn because of the aforementioned `-fms-extensions` (meaning only GCC 8 through 10 and LLVM 23 and 24 matter for warnings/errors, which is pretty narrow) but I do not want to rely on that if it is not expected and could be fixed at some point down the line.
cc @philnik777 @AaronBallman
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs