https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119366
Bug ID: 119366 Summary: [15 Regression] ICE: "free(): invalid pointer" in diagnostic_context::finish() (diagnostic.cc:427) with -Wfatal-errors Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: error-recovery Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnux32 Created attachment 60815 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60815&action=edit reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc -mx32 -Wfatal-errors testcase.c -wrapper valgrind,-q,--num-callers=100 testcase.c:1:1: error: X32 does not support 'ms_abi' attribute 1 | void foo() __attribute__((__ms_abi__)); | ^~~~ compilation terminated due to -Wfatal-errors. ==4219== Invalid free() / delete / delete[] / realloc() ==4219== at 0x484AB49: operator delete(void*, unsigned long) (vg_replace_malloc.c:1181) ==4219== by 0x2DE1305: diagnostic_context::finish() (diagnostic.cc:427) ==4219== by 0x2DE14A1: diagnostic_context::action_after_output(diagnostic_t) (diagnostic.cc:912) ==4219== by 0x2DE1A27: diagnostic_context::report_diagnostic(diagnostic_info*) (diagnostic.cc:1508) ==4219== by 0x2DE1C6D: diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) (diagnostic.cc:1614) ==4219== by 0x2DF67E1: error(char const*, ...) (diagnostic-global-context.cc:397) ==4219== by 0x1AD731B: ix86_function_type_abi(tree_node const*) (i386.cc:1616) ==4219== by 0x1AD8712: ix86_function_regparm (i386.cc:1205) ==4219== by 0x1AD8712: ix86_comp_type_attributes(tree_node const*, tree_node const*) (i386.cc:1180) ==4219== by 0xF08BB4: comp_type_attributes(tree_node const*, tree_node const*) (attribs.cc:1552) ==4219== by 0xF08DAA: build_type_attribute_qual_variant(tree_node*, tree_node*, int) (attribs.cc:1354) ==4219== by 0xF0BE4C: decl_attributes(tree_node**, tree_node*, int, tree_node*) (attribs.cc:1007) ==4219== by 0xF11E8A: c_decl_attributes(tree_node**, tree_node*, int) [clone .constprop.0] [clone .isra.0] (c-decl.cc:5558) ==4219== by 0xF2C847: start_decl(c_declarator*, c_declspecs*, bool, tree_node*, bool, unsigned long*) (c-decl.cc:5704) ==4219== by 0xF79700: c_parser_declaration_or_fndef(c_parser*, bool, bool, bool, bool, bool, bool, tree_node**, vec<c_token, va_heap, vl_ptr>*, bool, tree_node*, oacc_routine_data*, bool*) (c-parser.cc:2907) ==4219== by 0xFB8EB9: c_parser_external_declaration(c_parser*) (c-parser.cc:2105) ==4219== by 0xFB9D30: c_parser_translation_unit (c-parser.cc:1959) ==4219== by 0xFB9D30: c_parse_file() (c-parser.cc:29804) ==4219== by 0x10395A1: c_common_parse_file() (c-opts.cc:1379) ==4219== by 0x16919FD: compile_file() (toplev.cc:452) ==4219== by 0xF031BF: do_compile (toplev.cc:2208) ==4219== by 0xF031BF: toplev::main(int, char**) (toplev.cc:2371) ==4219== by 0xF04A0D: main (main.cc:39) ==4219== Address 0x1ffeffe9c0 is on thread 1's stack ==4219== in frame #10, created by decl_attributes(tree_node**, tree_node*, int, tree_node*) (attribs.cc:626) ==4219== $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20250319113901-r15-8284-gd0110185eb78f1-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/15.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-20250319113901-r15-8284-gd0110185eb78f1-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.1 20250319 (experimental) (GCC)