https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124433
Bug ID: 124433
Summary: [16 Regression] ICE: in maybe_get_value_range, at
analyzer/svalue.h:200 with -fanalyzer and modulo by
zero
Product: gcc
Version: 16.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 63868
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63868&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc -fanalyzer testcase.c
during IPA pass: analyzer
testcase.c: In function 'foo':
testcase.c:8:10: internal compiler error: in maybe_get_value_range, at
analyzer/svalue.h:200
8 | while (c);
| ^
0x2e78ecf internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0xe8b745 fancy_abort(char const*, int, char const*)
/repo/gcc-trunk/gcc/diagnostics/context.cc:1813
0x999968 ana::svalue::maybe_get_value_range(value_range&) const
/repo/gcc-trunk/gcc/analyzer/svalue.h:200
0x999b58 ana::svalue::maybe_get_value_range(value_range&) const
/repo/gcc-trunk/gcc/value-range.h:903
0x999b58 ana::unaryop_svalue::maybe_get_value_range_1(value_range&) const
/repo/gcc-trunk/gcc/analyzer/svalue.cc:1585
0x1be831c ana::svalue::maybe_get_value_range(value_range&) const
/repo/gcc-trunk/gcc/analyzer/svalue.h:198
0x1be831c ana::region_model::eval_condition(ana::svalue const*, tree_code,
ana::svalue const*) const
/repo/gcc-trunk/gcc/analyzer/region-model.cc:5386
0x1bf6033 ana::region_model::add_constraint(ana::svalue const*, tree_code,
ana::svalue const*, ana::region_model_context*)
/repo/gcc-trunk/gcc/analyzer/region-model.cc:5753
0x1bf7b5e ana::region_model::add_constraint(tree_node*, tree_code, tree_node*,
ana::region_model_context*, std::unique_ptr<ana::rejected_constraint,
std::default_delete<ana::rejected_constraint> >*)
/repo/gcc-trunk/gcc/analyzer/region-model.cc:5806
0x1bc905b ana::control_flow_op::execute(ana::operation_context&) const
/repo/gcc-trunk/gcc/analyzer/ops.cc:1283
0x1bab5bc ana::exploded_graph::process_node(ana::exploded_node*)
/repo/gcc-trunk/gcc/analyzer/engine.cc:3783
0x1babc3a ana::exploded_graph::process_worklist()
/repo/gcc-trunk/gcc/analyzer/engine.cc:3412
0x1baea71 ana::impl_run_checkers(ana::logger*)
/repo/gcc-trunk/gcc/analyzer/engine.cc:5272
0x1baf596 ana::run_checkers()
/repo/gcc-trunk/gcc/analyzer/engine.cc:5363
0x1b9f328 execute
/repo/gcc-trunk/gcc/analyzer/analyzer-pass.cc:81
/repo/gcc-trunk/binary-trunk-20260309124537-r16-7957-ge1eb2472c965a1-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-20260309124537-r16-7957-ge1eb2472c965a1-checking-yes-rtl-df-extra-amd64/bin/../lib/gcc/x86_64-pc-linux-gnu/16.0.1/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -fanalyzer -o /tmp/ccxvPWwn.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-20260309124537-r16-7957-ge1eb2472c965a1-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.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
--enable-libsanitizer --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-20260309124537-r16-7957-ge1eb2472c965a1-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260309 (experimental) (GCC)