Created attachment 55963 [details] coreutils fix for non gcc >= 11 Ever since https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8b7a9a24 declarations after labels are allowed by default, and only disabled with -pedantic etc. I.e. the following simple code compiles on gcc >= 11, but will fail when tried to be compiled with gcc <= 10, or clang for e.g. This is exacerbated by the fact there is no compiler option to avoid the issue on gcc <= 10 or clang, as that code is explicitly disallowed by C11 and earlier. int f(int x) { switch (x) { case 1: int i=f(x); } return 0; } There is also a more subtle related issue (which I haven't fully reduced but can easily reproduce), where the warning will NOT fire even with -Wpedantic on gcc 13 at least. If one compiles GNU coreutils with the attached commit reverted, and with -Wpedantic on newer gcc, it will _NOT_ issue a warning.
This is expected behavior. -Wc11-c2x-compat warns also ... >(which I haven't fully reduced but can easily reproduce), We need a testcase where you think it should warn but does not ...
Can you attach the original preprocessed source where you get no warning and you think you should. Others can reduce it.
Created attachment 55964 [details] coreutils tail.c compilation unit This should warn with -Wpedantic, but doesn't on gcc 13
Interestingly, gcc 13 _does_ warn with -Wc11-c2x-compat, but does not warn with -Wpedantic
Hmm, somehow the value of warn_c11_c2x_compat is being changed from -1 to 0 ... and not being changed back, maybe a __extension__ is happening incorrectly.
Actually wait: # 3997 "./lib/config.h" #pragma GCC diagnostic ignored "-Wpedantic" coreutils's config.h explictly disables -Wpedantic ... So not a bug.