https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104302
Bug ID: 104302 Summary: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: wjwray at gmail dot com Target Milestone: --- The following crashes: $ cat nes11.ii typedef unsigned int __uint32_t; typedef __uint32_t uint32_t; extern "C++" typedef unsigned char uint8; typedef uint32_t uint32; namespace Mednafen { struct StateMem; struct SFORMAT { enum class FORM : uint8; ; }; template <typename T> static __attribute__((always_inline)) SFORMAT SFBASE_(T* const v, const uint32 count, const char* const name); template <unsigned model, unsigned mem_size> struct X24C0xP { Mednafen::SFORMAT __trans_tmp_1; int StateAction(StateMem* sm, int load, int data_only, const char* sname) { SFORMAT StateRegs[] = { SFBASE_(SF_FORCE_A8(mem), mem_size, "mem"), __trans_tmp_1, SFBASE_, SFBASE_, SFBASE_, SFBASE_, SFBASE_, SFBASE_, SFBASE_, SFBASE_, }; return 0; } bool prev_sda_in, prev_scl_in; unsigned phase; uint8 mem[mem_size]; uint8 buf; uint8 bitpos; int sda_out; uint8 slave_addr; bool rw_bit; uint8 mem_addr; }; } // namespace Mednafen $ g++ nes11.ii -c nes11.ii: In member function ‘int Mednafen::X24C0xP<model, mem_size>::StateAction(Mednafen::StateMem*, int, int, const char*)’: nes11.ii:30:5: internal compiler error: Segmentation fault 30 | }; | ^ 0x17cb93a crash_signal /home/marxin/Programming/gcc/gcc/toplev.cc:322 0x7ffff789b41f ??? /usr/src/debug/glibc-2.34-4.3.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x1bf95bc strip_array_types(tree_node*) /home/marxin/Programming/gcc/gcc/tree.cc:7224 0xf664dc cp_type_quals(tree_node const*) /home/marxin/Programming/gcc/gcc/cp/typeck.cc:10950 0xf3a2ff cp_build_qualified_type_real(tree_node*, int, int) /home/marxin/Programming/gcc/gcc/cp/tree.cc:1355 0xf68924 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*) /home/marxin/Programming/gcc/gcc/cp/typeck.cc:1593 0xf68924 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*) /home/marxin/Programming/gcc/gcc/cp/typeck.cc:1585 0xc63294 reshape_init_r /home/marxin/Programming/gcc/gcc/cp/decl.cc:6801 0xc619c9 reshape_init_array_1 /home/marxin/Programming/gcc/gcc/cp/decl.cc:6398 0xc61c13 reshape_init_array /home/marxin/Programming/gcc/gcc/cp/decl.cc:6437 0xc6381a reshape_init_r /home/marxin/Programming/gcc/gcc/cp/decl.cc:6894 0xc63c30 reshape_init(tree_node*, tree_node*, int) /home/marxin/Programming/gcc/gcc/cp/decl.cc:6974 0xc71c68 cp_complete_array_type(tree_node**, tree_node*, bool) /home/marxin/Programming/gcc/gcc/cp/decl.cc:9574 0xc5fdc6 maybe_deduce_size_from_array_init /home/marxin/Programming/gcc/gcc/cp/decl.cc:6027 0xc6b151 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) /home/marxin/Programming/gcc/gcc/cp/decl.cc:8117 0xde05a5 cp_parser_init_declarator /home/marxin/Programming/gcc/gcc/cp/parser.cc:22823 0xdd0ef1 cp_parser_simple_declaration /home/marxin/Programming/gcc/gcc/cp/parser.cc:15286 0xdd0a31 cp_parser_block_declaration /home/marxin/Programming/gcc/gcc/cp/parser.cc:15106 0xdcefc4 cp_parser_declaration_statement /home/marxin/Programming/gcc/gcc/cp/parser.cc:14367 0xdc9f5c cp_parser_statement /home/marxin/Programming/gcc/gcc/cp/parser.cc:12452 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.