public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111526] New: inconsistent handling of declaration after label
@ 2023-09-21 18:02 P at draigBrady dot com
  2023-09-21 18:10 ` [Bug c/111526] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: P at draigBrady dot com @ 2023-09-21 18:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111526

            Bug ID: 111526
           Summary: inconsistent handling of declaration after label
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: P at draigBrady dot com
  Target Milestone: ---

Created attachment 55963
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55963&action=edit
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-21 18:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 18:02 [Bug c/111526] New: inconsistent handling of declaration after label P at draigBrady dot com
2023-09-21 18:10 ` [Bug c/111526] " pinskia at gcc dot gnu.org
2023-09-21 18:13 ` pinskia at gcc dot gnu.org
2023-09-21 18:26 ` P at draigBrady dot com
2023-09-21 18:28 ` P at draigBrady dot com
2023-09-21 18:43 ` pinskia at gcc dot gnu.org
2023-09-21 18:43 ` pinskia at gcc dot gnu.org
2023-09-21 18:45 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).