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

            Bug ID: 127398
           Summary: [16/17 Regression] ICE: in validate, at
                    analyzer/store.cc:720 with -fanalyzer on fully defined
                    code with strcpy()
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 65590
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65590&action=edit
reduced testcase

Contrary to PR127198, this code has defined behavior at runtime, as far as I
can tell (I am unsure about the _BitInt padding bits being defined on C level).

Compiler output:
$ x86_64-pc-linux-gnu-gcc -fanalyzer testcase.c 
during IPA pass: analyzer
testcase.c: In function 'foo':
testcase.c:10:3: internal compiler error: in validate, at analyzer/store.cc:720
   10 |   __builtin_strcpy((void *)&u.b, &c);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x2c5bbdd internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0xcb5bd5 fancy_abort(char const*, int, char const*)
        /repo/gcc-trunk/gcc/diagnostics/context.cc:1813
0x980f0d ana::concrete_binding_map::validate() const
        /repo/gcc-trunk/gcc/analyzer/store.cc:720
0x1a441d1 ana::binding_cluster::validate() const
        /repo/gcc-trunk/gcc/analyzer/store.cc:1783
0x1a441d1 ana::store::validate() const
        /repo/gcc-trunk/gcc/analyzer/store.cc:3001
0x19a54f0 ana::exploded_graph::get_or_create_node(ana::program_point const&,
ana::program_state const&, ana::exploded_node*, bool)
        /repo/gcc-trunk/gcc/analyzer/engine.cc:2500
0x19c7cf8 ana::operation_context::add_outcome(ana::program_point const&,
ana::program_state, bool, ana::uncertainty_t*,
std::unique_ptr<ana::custom_edge_info,
std::default_delete<ana::custom_edge_info> >)
        /repo/gcc-trunk/gcc/analyzer/ops.cc:160
0x19caa23 ana::gimple_stmt_op::execute_on_state(ana::operation_context&,
ana::program_state) const
        /repo/gcc-trunk/gcc/analyzer/ops.cc:464
0x19cb2ca ana::call_and_return_op::execute(ana::operation_context&) const
        /repo/gcc-trunk/gcc/analyzer/ops.cc:989
0x19a86eb ana::exploded_graph::process_node(ana::exploded_node*)
        /repo/gcc-trunk/gcc/analyzer/engine.cc:3519
0x19a8d7a ana::exploded_graph::process_worklist()
        /repo/gcc-trunk/gcc/analyzer/engine.cc:3147
0x19ab65b ana::impl_run_checkers(ana::logger*)
        /repo/gcc-trunk/gcc/analyzer/engine.cc:4846
0x19ac486 ana::run_checkers()
        /repo/gcc-trunk/gcc/analyzer/engine.cc:4937
0x199dae8 execute
        /repo/gcc-trunk/gcc/analyzer/analyzer-pass.cc:81
/repo/gcc-trunk/binary-trunk-20260915051942-g50be38676af-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-20260915051942-g50be38676af-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -fanalyzer -o /tmp/ccFmLaoz.s
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-20260915051942-g50be38676af-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.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
--disable-bootstrap --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-20260915051942-g50be38676af-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260915 (experimental) (GCC)

Reply via email to