https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111700

            Bug ID: 111700
           Summary: ICE: SIGSEGV in needs_read_p (input.cc:598) with
                    -fdiagnostics-format=sarif-file or
                    -fdiagnostics-format=sarif-stderr on pre-processed
                    input
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: diagnostic, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Compiler output:

$ cat tmp.i
# 0 ""
x;

$ x86_64-pc-linux-gnu-gcc -fdiagnostics-format=sarif-stderr tmp.i -wrapper
valgrind,-q
==21217== Invalid read of size 8
==21217==    at 0x289B3E4: needs_read_p (input.cc:598)
==21217==    by 0x289B3E4: maybe_read_data (input.cc:665)
==21217==    by 0x289B3E4: file_cache_slot::get_next_line(char**, long*)
(input.cc:715)
==21217==    by 0x289C6BF: get_full_file_content (input.cc:471)
==21217==    by 0x289C6BF: file_cache::get_source_file_content(char const*)
(input.cc:1075)
==21217==    by 0x2877B83:
sarif_builder::maybe_make_artifact_content_object(char const*) const
(diagnostic-format-sarif.cc:1545)
==21217==    by 0x2877D1F: sarif_builder::make_artifact_object(char const*)
(diagnostic-format-sarif.cc:1524)
==21217==    by 0x2879FF7: sarif_builder::make_run_object(sarif_invocation*,
json::array*) (diagnostic-format-sarif.cc:1340)
==21217==    by 0x287A22E:
sarif_builder::make_top_level_object(sarif_invocation*, json::array*)
(diagnostic-format-sarif.cc:1296)
==21217==    by 0x287A285: sarif_builder::flush_to_file(_IO_FILE*)
(diagnostic-format-sarif.cc:473)
==21217==    by 0x287C200: ~sarif_stream_output_format
(diagnostic-format-sarif.cc:1749)
==21217==    by 0x287C200:
sarif_stream_output_format::~sarif_stream_output_format()
(diagnostic-format-sarif.cc:1750)
==21217==    by 0x286E861: diagnostic_finish(diagnostic_context*)
(diagnostic.cc:304)
==21217==    by 0xDBAA7F: toplev::main(int, char**) (toplev.cc:2310)
==21217==    by 0xDBCA7A: main (main.cc:39)
==21217==  Address 0x10 is not stack'd, malloc'd or (recently) free'd


$ x86_64-pc-linux-gnu-gcc -fdiagnostics-format=sarif-file tmp.i -wrapper
valgrind,-q
==32755== Invalid read of size 8
==32755==    at 0x289B3E4: needs_read_p (input.cc:598)
==32755==    by 0x289B3E4: maybe_read_data (input.cc:665)
==32755==    by 0x289B3E4: file_cache_slot::get_next_line(char**, long*)
(input.cc:715)
==32755==    by 0x289C6BF: get_full_file_content (input.cc:471)
==32755==    by 0x289C6BF: file_cache::get_source_file_content(char const*)
(input.cc:1075)
==32755==    by 0x2877B83:
sarif_builder::maybe_make_artifact_content_object(char const*) const
(diagnostic-format-sarif.cc:1545)
==32755==    by 0x2877D1F: sarif_builder::make_artifact_object(char const*)
(diagnostic-format-sarif.cc:1524)
==32755==    by 0x2879FF7: sarif_builder::make_run_object(sarif_invocation*,
json::array*) (diagnostic-format-sarif.cc:1340)
==32755==    by 0x287A22E:
sarif_builder::make_top_level_object(sarif_invocation*, json::array*)
(diagnostic-format-sarif.cc:1296)
==32755==    by 0x287A285: sarif_builder::flush_to_file(_IO_FILE*)
(diagnostic-format-sarif.cc:473)
==32755==    by 0x287BE31:
sarif_file_output_format::~sarif_file_output_format()
(diagnostic-format-sarif.cc:1778)
==32755==    by 0x287C018:
sarif_file_output_format::~sarif_file_output_format()
(diagnostic-format-sarif.cc:1781)
==32755==    by 0x286E861: diagnostic_finish(diagnostic_context*)
(diagnostic.cc:304)
==32755==    by 0xDBAA7F: toplev::main(int, char**) (toplev.cc:2310)
==32755==    by 0xDBCA7A: main (main.cc:39)
==32755==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==32755== 
error: unable to open '' for writing: No such file or directory
Internal compiler error:
0x14a9ccf crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:314
...

$ 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-20231003001722-g41d1c9a9795-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.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-20231003001722-g41d1c9a9795-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231003 (experimental) (GCC)

Reply via email to