https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106133
Bug ID: 106133 Summary: ICE: SIGSEGV in diagnostic_output_format_init_json_file() with -fdiagnostics-format=json-file -E Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: ice-on-valid-code 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 Compiler output: $ echo -n > empty.c $ x86_64-pc-linux-gnu-gcc -fdiagnostics-format=json-file -E empty.c -wrapper valgrind,-q ==20305== Invalid read of size 1 ==20305== at 0x4846FA2: strlen (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==20305== by 0x2634511: xstrdup (xstrdup.c:33) ==20305== by 0x25A92C8: diagnostic_output_format_init_json_file(diagnostic_context*, char const*) (diagnostic-format-json.cc:375) ==20305== by 0x258BF28: common_handle_option(gcc_options*, gcc_options*, cl_decoded_option const*, unsigned int, int, unsigned int, cl_option_handlers const*, diagnostic_context*, void (*)()) (opts.cc:2853) ==20305== by 0x2590F38: handle_option(gcc_options*, gcc_options*, cl_decoded_option const*, unsigned int, int, unsigned int, cl_option_handlers const*, bool, diagnostic_context*) (opts-common.cc:1246) ==20305== by 0x259106E: read_cmdline_option(gcc_options*, gcc_options*, cl_decoded_option*, unsigned int, unsigned int, cl_option_handlers const*, diagnostic_context*) (opts-common.cc:1574) ==20305== by 0x129BC64: read_cmdline_options (opts-global.cc:239) ==20305== by 0x129BC64: decode_options(gcc_options*, gcc_options*, cl_decoded_option*, unsigned int, unsigned int, diagnostic_context*, void (*)()) (opts-global.cc:321) ==20305== by 0xD114AD: toplev::main(int, char**) (toplev.cc:2265) ==20305== by 0xD13A6A: main (main.cc:39) ==20305== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==20305== 0x13a859f crash_signal /repo/gcc-trunk/gcc/toplev.cc:322 0x2634511 xstrdup /repo/gcc-trunk/libiberty/xstrdup.c:33 0x25a92c8 diagnostic_output_format_init_json_file(diagnostic_context*, char const*) /repo/gcc-trunk/gcc/diagnostic-format-json.cc:375 0x258bf28 common_handle_option(gcc_options*, gcc_options*, cl_decoded_option const*, unsigned int, int, unsigned int, cl_option_handlers const*, diagnostic_context*, void (*)()) /repo/gcc-trunk/gcc/opts.cc:2853 0x2590f38 handle_option /repo/gcc-trunk/gcc/opts-common.cc:1246 0x259106e read_cmdline_option(gcc_options*, gcc_options*, cl_decoded_option*, unsigned int, unsigned int, cl_option_handlers const*, diagnostic_context*) /repo/gcc-trunk/gcc/opts-common.cc:1574 0x129bc64 read_cmdline_options /repo/gcc-trunk/gcc/opts-global.cc:239 0x129bc64 decode_options(gcc_options*, gcc_options*, cl_decoded_option*, unsigned int, unsigned int, diagnostic_context*, void (*)()) /repo/gcc-trunk/gcc/opts-global.cc:321 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. $ 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-r13-1327-20220628144301-g243b5396106-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/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 --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 --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r13-1327-20220628144301-g243b5396106-checking-yes-rtl-df-extra-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.0.0 20220628 (experimental) (GCC)