https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127162
Bug ID: 127162
Summary: internal compiler error: in verify_mask, at
value-range.cc:3125 with -O2
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: lu.maltsis at postgrad dot manchester.ac.uk
Target Milestone: ---
<source>: In function 'main':
<source>:13:9: warning: division by zero [-Wdiv-by-zero]
13 | if (1 / 0)
| ^
during IPA pass: cp
<source>:22:1: internal compiler error: in verify_mask, at value-range.cc:3125
22 | }
| ^
0x2844868 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x28394ab internal_error(char const*, ...)
???:0
0xa43692 fancy_abort(char const*, int, char const*)
???:0
0xf7b7da analysis_dom_walker::before_dom_children(basic_block_def*)
???:0
0x255ce97 dom_walker::walk(basic_block_def*)
???:0
0xf78a0e ipa_analyze_node(cgraph_node*)
???:0
0x10de88a execute_ipa_summary_passes(ipa_opt_pass_d*)
???:0
0xc7d186 symbol_table::finalize_compilation_unit()
???:0
/cefs/41/417d0af575e3216d3bdabb64_gcc-trunk-20260831/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/41/417d0af575e3216d3bdabb64_gcc-trunk-20260831/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
<source> -quiet -dumpdir /app/ -dumpbase output.c -dumpbase-ext .c -masm=intel
-mtune=generic -march=x86-64 -g -O2 -fdiagnostics-color=always -fno-verbose-asm
-o /app/output.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.
Compiler returned: 1
Reproducer:
void f (int *p, int **q)
{
int i;
while(1) { *q++ = &p[i];}
}
int main ()
{
void *p;
int *q[40];
__SIZE_TYPE__ start;
if (1 / 0)
start = (__SIZE_TYPE__) __INT_MAX__;
else if (sizeof(start) == sizeof(long))
start = (__SIZE_TYPE__) __LONG_MAX__;
p = (void *)start;
f (p, q);
return 0;
}
https://godbolt.org/z/ETTc387bG
Commit: 8ab522ef603351253110dbd8b9a841cd9be524d2 (trunk)
Needs assertions and -O2 or higher
The infinite loop and the zero divsion seem to be necessary for it to trigger.
Bissection with compiler explorer: triggers 15.1, doesnt trigger 14.4