https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112493
Bug ID: 112493 Summary: GCC: 14: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: 141242068 at smail dot nju.edu.cn Target Milestone: --- Compiler Explorer: https://gcc.godbolt.org/z/971ccPba8 When tries to compile this program with `gcc-14 -O1`, gcc throws internal compiler error: ``` #define BIG_ENDIAN \ __attribute__((scalar_storage_order("big-endian"))) typedef struct { union { char addr8[16]; } u; } ip6_addr_t; typedef struct { char is_v4; union { int addr; ip6_addr_t addr6; } u; } net_addr_t; typedef struct { union { char addr8[16]; } u; } be_ip6_addr_t; typedef struct { char is_v4; union { be_ip6_addr_t addr6; char addr; } BIG_ENDIAN u; } BIG_ENDIAN be_net_addr_t; struct T { const net_addr_t ip; be_ip6_addr_t rc; } v; be_ip6_addr_t be_ip6_addr(const ip6_addr_t ip6) { return v.rc; } be_net_addr_t be_net_addr(const net_addr_t ip) { be_net_addr_t rc; if (v.ip.is_v4) { rc.u.addr = v.ip.u.addr; } else { rc.u.addr6 = be_ip6_addr(v.ip.u.addr6); } return rc; } ``` The crash output: ``` <source>:27:19: warning: type punning toggles scalar storage order [-Wscalar-storage-order] 27 | be_ip6_addr_t addr6; | ^~~~~ during GIMPLE pass: sra <source>: In function 'be_net_addr': <source>:41:15: internal compiler error: in verify_sra_access_forest, at tree-sra.cc:2421 41 | be_net_addr_t be_net_addr(const net_addr_t ip) { | ^~~~~~~~~~~ 0x238b15e internal_error(char const*, ...) ???:0 0xa11270 fancy_abort(char const*, int, char const*) ???:0 0x1226f82 verify_all_sra_access_forests() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 ```