public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions
@ 2024-03-16  8:48 muecker at gwdg dot de
  2024-03-28  6:29 ` [Bug c/114361] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: muecker at gwdg dot de @ 2024-03-16  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114361
           Summary: ICE with c23 when creating mutually nested and
                    compatible types with statement expressions
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

This fails in verify_type (goes away with -fchecking=0):

void f()
{
    typedef struct foo bar;
    typedef __typeof( ({ (struct foo { bar *x; }){ }; }) ) wuz;
    struct foo { wuz *x; };
}

https://godbolt.org/z/q7n5xbsc1

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

* [Bug c/114361] ICE with c23 when creating mutually nested and compatible types with statement expressions
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
@ 2024-03-28  6:29 ` pinskia at gcc dot gnu.org
  2024-03-28  6:31 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-28  6:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh it needs -g too.

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

* [Bug c/114361] ICE with c23 when creating mutually nested and compatible types with statement expressions
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
  2024-03-28  6:29 ` [Bug c/114361] " pinskia at gcc dot gnu.org
@ 2024-03-28  6:31 ` pinskia at gcc dot gnu.org
  2024-03-29  8:51 ` muecker at gwdg dot de
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-28  6:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 114014.

*** This bug has been marked as a duplicate of bug 114014 ***

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

* [Bug c/114361] ICE with c23 when creating mutually nested and compatible types with statement expressions
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
  2024-03-28  6:29 ` [Bug c/114361] " pinskia at gcc dot gnu.org
  2024-03-28  6:31 ` pinskia at gcc dot gnu.org
@ 2024-03-29  8:51 ` muecker at gwdg dot de
  2024-03-29  8:53 ` muecker at gwdg dot de
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: muecker at gwdg dot de @ 2024-03-29  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Uecker <muecker at gwdg dot de> ---
Created attachment 57834
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57834&action=edit
patch



Tentative patch.

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

* [Bug c/114361] ICE with c23 when creating mutually nested and compatible types with statement expressions
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
                   ` (2 preceding siblings ...)
  2024-03-29  8:51 ` muecker at gwdg dot de
@ 2024-03-29  8:53 ` muecker at gwdg dot de
  2024-04-02 22:09 ` [Bug c/114361] ICE with c23 related to completion of incomplete structure types cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: muecker at gwdg dot de @ 2024-03-29  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Uecker <muecker at gwdg dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |UNCONFIRMED

--- Comment #4 from Martin Uecker <muecker at gwdg dot de> ---

Though similar symptoms, this is not a duplicate for 114014

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

* [Bug c/114361] ICE with c23 related to completion of incomplete structure types
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
                   ` (3 preceding siblings ...)
  2024-03-29  8:53 ` muecker at gwdg dot de
@ 2024-04-02 22:09 ` cvs-commit at gcc dot gnu.org
  2024-04-03  5:46 ` uecker at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-02 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:

https://gcc.gnu.org/g:871bb5ad2dd56343d80b6a6d269e85efdc9999e5

commit r14-9763-g871bb5ad2dd56343d80b6a6d269e85efdc9999e5
Author: Martin Uecker <uecker@tugraz.at>
Date:   Thu Mar 28 19:15:40 2024 +0100

    Fix ICE with -g and -std=c23 related to incomplete types [PR114361]

    We did not copy TYPE_CANONICAL to the incomplete variants when
    completing a structure.

            PR c/114361

            gcc/c/
            * c-decl.cc (finish_struct): Set TYPE_CANONICAL when completing
            strucute types.

            gcc/testsuite/
            * gcc.dg/pr114361.c: New test.
            * gcc.dg/c23-tag-incomplete-1.c: New test.
            * gcc.dg/c23-tag-incomplete-2.c: New test.

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

* [Bug c/114361] ICE with c23 related to completion of incomplete structure types
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
                   ` (4 preceding siblings ...)
  2024-04-02 22:09 ` [Bug c/114361] ICE with c23 related to completion of incomplete structure types cvs-commit at gcc dot gnu.org
@ 2024-04-03  5:46 ` uecker at gcc dot gnu.org
  2024-04-05 10:23 ` muecker at gwdg dot de
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-04-03  5:46 UTC (permalink / raw)
  To: gcc-bugs

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

uecker at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |uecker at gcc dot gnu.org
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED

--- Comment #6 from uecker at gcc dot gnu.org ---
Fixed for 14

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

* [Bug c/114361] ICE with c23 related to completion of incomplete structure types
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
                   ` (5 preceding siblings ...)
  2024-04-03  5:46 ` uecker at gcc dot gnu.org
@ 2024-04-05 10:23 ` muecker at gwdg dot de
  2024-04-19 22:11 ` cvs-commit at gcc dot gnu.org
  2024-04-20  6:47 ` uecker at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: muecker at gwdg dot de @ 2024-04-05 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Uecker <muecker at gwdg dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=114574
             Status|RESOLVED                    |UNCONFIRMED

--- Comment #7 from Martin Uecker <muecker at gwdg dot de> ---
Reopen bug as setting TYPE_CANONICAL is not so simple, see PR 114574

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

* [Bug c/114361] ICE with c23 related to completion of incomplete structure types
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
                   ` (6 preceding siblings ...)
  2024-04-05 10:23 ` muecker at gwdg dot de
@ 2024-04-19 22:11 ` cvs-commit at gcc dot gnu.org
  2024-04-20  6:47 ` uecker at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-19 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r14-10045-ga39983bf58d3097c472252f6989d19b60909dd9a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 20 00:05:21 2024 +0200

    c: Fix ICE with -g and -std=c23 related to incomplete types [PR114361]

    We did not update TYPE_CANONICAL for incomplete variants when
    completing a structure.  We now set for flag_isoc23
TYPE_STRUCTURAL_EQUALITY_P
    for incomplete structure and union types and then update TYPE_CANONICAL
    later, though update it only for the variants and derived pointer types
    which can be easily discovered.  Other derived types created while
    the type was still incomplete will remain TYPE_STRUCTURAL_EQUALITY_P.
    See PR114574 for discussion.

    2024-04-20  Martin Uecker  <uecker@tugraz.at>
                Jakub Jelinek  <jakub@redhat.com>

            PR lto/114574
            PR c/114361
    gcc/c/
            * c-decl.cc (shadow_tag_warned): For flag_isoc23 and code not
            ENUMERAL_TYPE use SET_TYPE_STRUCTURAL_EQUALITY.
            (parser_xref_tag): Likewise.
            (start_struct): For flag_isoc23 use SET_TYPE_STRUCTURAL_EQUALITY.
            (c_update_type_canonical): New function.
            (finish_struct): Put NULL as second == operand rather than first.
            Assert TYPE_STRUCTURAL_EQUALITY_P.  Call c_update_type_canonical.
            * c-typeck.cc (composite_type_internal): Use
            SET_TYPE_STRUCTURAL_EQUALITY.  Formatting fix.
    gcc/testsuite/
            * gcc.dg/pr114574-1.c: New test.
            * gcc.dg/pr114574-2.c: New test.
            * gcc.dg/pr114361.c: New test.
            * gcc.dg/c23-tag-incomplete-1.c: New test.
            * gcc.dg/c23-tag-incomplete-2.c: New test.

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

* [Bug c/114361] ICE with c23 related to completion of incomplete structure types
  2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
                   ` (7 preceding siblings ...)
  2024-04-19 22:11 ` cvs-commit at gcc dot gnu.org
@ 2024-04-20  6:47 ` uecker at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-04-20  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

uecker at gcc dot gnu.org changed:

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

--- Comment #9 from uecker at gcc dot gnu.org ---
Fixed.

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

end of thread, other threads:[~2024-04-20  6:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-16  8:48 [Bug c/114361] New: ICE with c23 when creating mutually nested and compatible types with statement expressions muecker at gwdg dot de
2024-03-28  6:29 ` [Bug c/114361] " pinskia at gcc dot gnu.org
2024-03-28  6:31 ` pinskia at gcc dot gnu.org
2024-03-29  8:51 ` muecker at gwdg dot de
2024-03-29  8:53 ` muecker at gwdg dot de
2024-04-02 22:09 ` [Bug c/114361] ICE with c23 related to completion of incomplete structure types cvs-commit at gcc dot gnu.org
2024-04-03  5:46 ` uecker at gcc dot gnu.org
2024-04-05 10:23 ` muecker at gwdg dot de
2024-04-19 22:11 ` cvs-commit at gcc dot gnu.org
2024-04-20  6:47 ` uecker 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).