[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-30 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

--- Comment #6 from GCC Commits  ---
The master branch has been updated by Martin Uecker :

https://gcc.gnu.org/g:0e0f963bcfbfce351dd4aad82e6dbc6fc84a0724

commit r16-982-g0e0f963bcfbfce351dd4aad82e6dbc6fc84a0724
Author: Martin Uecker 
Date:   Thu May 29 19:13:46 2025 +0200

c: fix ICE for mutually recursive structures [PR120381]

For invalid nesting of a structure definition in a definition
of itself or when using a rather obscure construction using statement
expressions, we can create mutually recursive pairs of non-identical
but compatible structure types.  This can lead to invalid composite
types and an ICE.  If we detect recursion even for swapped pairs
when forming composite types, this is avoided.

PR c/120381

gcc/c/ChangeLog:
* c-typeck.cc (composite_type_internal): Stop recursion for
swapped pairs.

gcc/testsuite/ChangeLog:
* gcc.dg/pr120381.c: New test.
* gcc.dg/gnu23-tag-composite-6.c: New test.

[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-29 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

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

Turns out one can trigger this also using statement expressions: 
https://godbolt.org/z/3M8en31zd

PATCH: https://gcc.gnu.org/pipermail/gcc-patches/2025-May/685119.html

[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-29 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

--- Comment #4 from uecker at gcc dot gnu.org ---
Created attachment 61548
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61548&action=edit
patch for trunk

[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-23 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|14.3|14.4

--- Comment #3 from Richard Biener  ---
GCC 14.3 is being released, retargeting bugs to GCC 14.4.

[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-23 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-21 Thread jsm28 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

--- Comment #2 from Joseph S. Myers  ---
Nesting one definition of struct A inside another is never valid (and the
godbolt link shows the expected "nested redefinition" error that the PR doesn't
quote).

[Bug c/120381] [14/15/16 Regression] internal compiler error: in composite_type_internal, at c/c-typeck.cc:848

2025-05-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120381

Andrew Pinski  changed:

   What|Removed |Added

Summary|internal compiler error: in |[14/15/16 Regression]
   |composite_type_internal, at |internal compiler error: in
   |c/c-typeck.cc:848   |composite_type_internal, at
   ||c/c-typeck.cc:848
   Target Milestone|--- |14.3