https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118266
Bug ID: 118266 Summary: [15 Regression] ICE in maybe_record_trace_start, at dwarf2cfi.cc:2591 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: doko at gcc dot gnu.org Target Milestone: --- seen with trunk 20250101 building a x86_64-linux-gnux32 cross compiler on x86_64-linux-gnu, in libgfortran. using -O1 instead of -O2 avoids the ICE. apparently this only happens when having some hardening flags directly enabled in the compiler. /home/packages/cross/15/u/gcc-cross-ports/gcc/build/./gcc/xgcc -B/home/packages/cross/15/u/gcc-cross-ports/gcc/build/./gcc/ -B/usr/x86_64-linux-gnux32/bin/ -B/usr/x86_64-linux-gnux32/lib/ -isystem /usr/x86_64-linux-gnux32/include -isystem /usr/x86_64-linux-gnux32/sys-include -isystem /home/packages/cross/15/u/gcc-cross-ports/gcc/build/sys-include -DHAVE_CONFIG_H -I. -I../../../src/libgfortran -iquote../../../src/libgfortran/io -I../../../src/libgfortran/../gcc -I../../../src/libgfortran/../gcc/config -I../.././gcc -I../../../src/libgfortran/../libgcc -I../libgcc -I../../../src/libgfortran/../libbacktrace -I../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla -fcf-protection -mshstk -fcx-fortran-rules -ffunction-sections -fdata-sections -g -O2 -MT io/transfer.lo -MD -MP -MF io/.deps/transfer.Tpo -c ../../../src/libgfortran/io/transfer.c -o io/transfer.o during RTL pass: dwarf2 ../../../src/libgfortran/io/transfer.c: In function 'require_one_of_two_types.constprop': ../../../src/libgfortran/io/transfer.c:1523:1: internal compiler error: in maybe_record_trace_start, at dwarf2cfi.cc:2591 1523 | } | ^ 0x26e8f94 internal_error(char const*, ...) ../../src/gcc/diagnostic-global-context.cc:517 0x991705 fancy_abort(char const*, int, char const*) ../../src/gcc/diagnostic.cc:1722 0x79a53e maybe_record_trace_start ../../src/gcc/dwarf2cfi.cc:2591 0xbfeaf3 create_trace_edges ../../src/gcc/dwarf2cfi.cc:2694 0xbfefbc scan_trace ../../src/gcc/dwarf2cfi.cc:2918 0xbff950 create_cfi_notes ../../src/gcc/dwarf2cfi.cc:2945 0xbff950 execute_dwarf2_frame ../../src/gcc/dwarf2cfi.cc:3316 0xbff950 execute ../../src/gcc/dwarf2cfi.cc:3798 Please submit a full bug report, with preprocessed source (by using -freport-bug). $ cat transfer.i char require_one_of_two_types___trans_tmp_4, require_one_of_two_types___trans_tmp_3, require_one_of_two_types___trans_tmp_2; int require_one_of_two_types_dtp; extern __inline __attribute__((__gnu_inline__)) int snprintf(char *__s, unsigned __n, const char *__fmt, ...) { return __builtin___snprintf_chk(__s, __n, 1, 0, __fmt, __builtin_va_arg_pack()); } # 1 "" 3 typedef enum { BT_UNSIGNED } bt; void format_error(); bt require_one_of_two_types_expected1; int require_one_of_two_types() { char buffer[100]; if (require_one_of_two_types_expected1) return 0; snprintf(buffer, 0, "Expected %s or %s for item %d in formatted transfer, got %s", require_one_of_two_types___trans_tmp_2, require_one_of_two_types___trans_tmp_3, require_one_of_two_types_dtp, require_one_of_two_types___trans_tmp_4); format_error(buffer); } $ /home/packages/cross/15/u/gcc-cross-ports/gcc/build/gcc/xgcc -B/home/packages/cross/15/u/gcc-cross-ports/gcc/build/gcc/ -c -std=gnu11 -O2 transfer.i during RTL pass: dwarf2 : In function 'require_one_of_two_types': :14:1: internal compiler error: in maybe_record_trace_start, at dwarf2cfi.cc:2591 0x26e8f94 internal_error(char const*, ...) ../../src/gcc/diagnostic-global-context.cc:517 0x991705 fancy_abort(char const*, int, char const*) ../../src/gcc/diagnostic.cc:1722 0x79a53e maybe_record_trace_start ../../src/gcc/dwarf2cfi.cc:2591 0xbfee95 scan_trace ../../src/gcc/dwarf2cfi.cc:2791 0xbff950 create_cfi_notes ../../src/gcc/dwarf2cfi.cc:2945 0xbff950 execute_dwarf2_frame ../../src/gcc/dwarf2cfi.cc:3316 0xbff950 execute ../../src/gcc/dwarf2cfi.cc:3798 Please submit a full bug report, with preprocessed source (by using -freport-bug).