public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112571] New: ICE with nested redefinition of enum
@ 2023-11-16 18:42 uecker at gcc dot gnu.org
  2023-11-16 18:45 ` [Bug c/112571] " uecker at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: uecker at gcc dot gnu.org @ 2023-11-16 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112571
           Summary: ICE with nested redefinition of enum
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: uecker at gcc dot gnu.org
  Target Milestone: ---

The following code ICEs on trunk but not on 13.2 with -std=c2x

typedef __SIZE_TYPE__ size_t;
enum h : typeof (enum h { D }) { D };

https://godbolt.org/z/cd1o75M3W

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

* [Bug c/112571] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
@ 2023-11-16 18:45 ` uecker at gcc dot gnu.org
  2023-11-19 20:04 ` [Bug c/112571] [13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: uecker at gcc dot gnu.org @ 2023-11-16 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from uecker at gcc dot gnu.org ---

Another example:

enum X : typeof(enum X { A });

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

* [Bug c/112571] [13/14 Regression] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
  2023-11-16 18:45 ` [Bug c/112571] " uecker at gcc dot gnu.org
@ 2023-11-19 20:04 ` pinskia at gcc dot gnu.org
  2024-01-31 21:40 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-19 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.3.0
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |13.3
     Ever confirmed|0                           |1
            Summary|ICE with nested             |[13/14 Regression] ICE with
                   |redefinition of enum        |nested redefinition of enum
   Last reconfirmed|                            |2023-11-19
      Known to fail|                            |13.1.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

>but not on 13.2 with -std=c2x
Yes it does just hidden from the user really:
<source>:3: confused by earlier errors, bailing out

is an ICE after an error with --enable-checking=release (which is the default
for release branches).

Anyways 12.x didn't ICE for the one in comment #1.

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

* [Bug c/112571] [13/14 Regression] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
  2023-11-16 18:45 ` [Bug c/112571] " uecker at gcc dot gnu.org
  2023-11-19 20:04 ` [Bug c/112571] [13/14 Regression] " pinskia at gcc dot gnu.org
@ 2024-01-31 21:40 ` cvs-commit at gcc dot gnu.org
  2024-01-31 21:44 ` jsm28 at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-31 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <jsm28@gcc.gnu.org>:

https://gcc.gnu.org/g:d22d1a9346f27db41459738c6eb404f8f0956e6f

commit r14-8669-gd22d1a9346f27db41459738c6eb404f8f0956e6f
Author: Joseph Myers <josmyers@redhat.com>
Date:   Wed Jan 31 21:39:53 2024 +0000

    c: Fix ICE for nested enum redefinitions with/without fixed underlying type
[PR112571]

    Bug 112571 reports an ICE-on-invalid for cases where an enum is
    defined, without a fixed underlying type, inside the enum type
    specifier for a definition of that same enum with a fixed underlying
    type.

    The ultimate cause is attempting to access ENUM_UNDERLYING_TYPE in a
    case where it is NULL.  Avoid this by clearing
    ENUM_FIXED_UNDERLYING_TYPE_P in thie case of inconsistent definitions.

    Bootstrapped wth no regressions for x86_64-pc-linux-gnu.

            PR c/112571

    gcc/c/
            * c-decl.cc (start_enum): Clear ENUM_FIXED_UNDERLYING_TYPE_P when
            defining without a fixed underlying type an enumeration previously
            declared with a fixed underlying type.

    gcc/testsuite/
            * gcc.dg/c23-enum-9.c, gcc.dg/c23-enum-10.c: New tests.

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

* [Bug c/112571] [13/14 Regression] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-31 21:40 ` cvs-commit at gcc dot gnu.org
@ 2024-01-31 21:44 ` jsm28 at gcc dot gnu.org
  2024-03-23 21:44 ` [Bug c/112571] [13 " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-01-31 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jsm28 at gcc dot gnu.org
      Known to work|                            |14.0
             Status|NEW                         |ASSIGNED

--- Comment #4 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Fixed for GCC 14 so far.

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

* [Bug c/112571] [13 Regression] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-31 21:44 ` jsm28 at gcc dot gnu.org
@ 2024-03-23 21:44 ` pinskia at gcc dot gnu.org
  2024-03-25 22:51 ` cvs-commit at gcc dot gnu.org
  2024-03-25 22:54 ` jsm28 at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-23 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gscfq@t-online.de

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107683 has been marked as a duplicate of this bug. ***

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

* [Bug c/112571] [13 Regression] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-23 21:44 ` [Bug c/112571] [13 " pinskia at gcc dot gnu.org
@ 2024-03-25 22:51 ` cvs-commit at gcc dot gnu.org
  2024-03-25 22:54 ` jsm28 at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-25 22:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Joseph Myers
<jsm28@gcc.gnu.org>:

https://gcc.gnu.org/g:f2af129b68bc6b20f79a9a44b28c96650baa702c

commit r13-8495-gf2af129b68bc6b20f79a9a44b28c96650baa702c
Author: Joseph Myers <josmyers@redhat.com>
Date:   Wed Jan 31 21:39:53 2024 +0000

    c: Fix ICE for nested enum redefinitions with/without fixed underlying type
[PR112571]

    Bug 112571 reports an ICE-on-invalid for cases where an enum is
    defined, without a fixed underlying type, inside the enum type
    specifier for a definition of that same enum with a fixed underlying
    type.

    The ultimate cause is attempting to access ENUM_UNDERLYING_TYPE in a
    case where it is NULL.  Avoid this by clearing
    ENUM_FIXED_UNDERLYING_TYPE_P in thie case of inconsistent definitions.

    Bootstrapped wth no regressions for x86_64-pc-linux-gnu.

    (Note: for this GCC 13 branch backport, the tests were changed to use
    -std=c2x not -std=c23, and c23-enum-9.c was changed to expect
    different diagnostics because GCC 13 branch doesn't have the C23 tag
    compatibility support for redefinitions of tagged types and
    enumerators.)

            PR c/112571

    gcc/c/
            * c-decl.cc (start_enum): Clear ENUM_FIXED_UNDERLYING_TYPE_P when
            defining without a fixed underlying type an enumeration previously
            declared with a fixed underlying type.

    gcc/testsuite/
            * gcc.dg/c23-enum-9.c, gcc.dg/c23-enum-10.c: New tests.

    (cherry picked from commit d22d1a9346f27db41459738c6eb404f8f0956e6f)

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

* [Bug c/112571] [13 Regression] ICE with nested redefinition of enum
  2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-25 22:51 ` cvs-commit at gcc dot gnu.org
@ 2024-03-25 22:54 ` jsm28 at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-03-25 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Fix now backported to GCC 13 branch, so fixed in 13.3 as well.

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

end of thread, other threads:[~2024-03-25 22:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16 18:42 [Bug c/112571] New: ICE with nested redefinition of enum uecker at gcc dot gnu.org
2023-11-16 18:45 ` [Bug c/112571] " uecker at gcc dot gnu.org
2023-11-19 20:04 ` [Bug c/112571] [13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-31 21:40 ` cvs-commit at gcc dot gnu.org
2024-01-31 21:44 ` jsm28 at gcc dot gnu.org
2024-03-23 21:44 ` [Bug c/112571] [13 " pinskia at gcc dot gnu.org
2024-03-25 22:51 ` cvs-commit at gcc dot gnu.org
2024-03-25 22:54 ` jsm28 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).