https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127530
Bug ID: 127530
Summary: ICE in comptypes_check_enum_int redeclaring a typedef
whose type carries scalar_storage_order
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: captainnemo9292 at gmail dot com
Target Milestone: ---
Target: x86_64-linux-gnu
struct a { int x; };
typedef struct a __attribute__((scalar_storage_order("big-endian"))) b;
typedef struct a __attribute__((scalar_storage_order("big-endian"))) b;
$ gcc -c t.c
t.c:3:16: internal compiler error: in comptypes_check_enum_int, at
c/c-typeck.cc:1653
fancy_abort
pushdecl(tree_node*)
start_decl
https://godbolt.org/z/8n7s7Pvzs
Repeating a typedef is allowed in C11, so pushdecl compares the two types.
scalar_storage_order produces a distinct variant of 'struct a', and the
comparison hits the gcc_checking_assert in comptypes_check_enum_int for that
variant. Without the attribute the second typedef is accepted silently.
gcc trunk 17.0.0 20260920.