https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128931
Bug ID: 128931
Summary: [17 Regression] ICE on AVR port after changes for
PR128672
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: law at gcc dot gnu.org
Target Milestone: ---
This change:
commit f61ae2cb8d38929cb3761631160fdfa58e59fdc4
Author: Richard Biener <[email protected]>
Date: Wed Nov 18 15:20:02 2026 +0100
tree-optimization/128672 - avoid UB in CSE of -x / y
When we try to CSE -x / y with x / y we have to avoid presenting
a negate as if it were in the IL to the match-and-simplify machinery.
Instead we have to check whether the negate is available literally
when negation may invoke UB. The identity also doesn't hold for
INT_MIN.
Tripped this regression on the AVR port:
Tests that now fail, but worked before (1 tests):
avr-sim: gcc: gcc.dg/fixed-point/pr81428.c (test for excess errors)
Which is an ICE under the hood:
./cc1 -O2 j.c
foo
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> {heap 988k} <visibility> {heap 988k} <build_ssa_passes>
{heap 988k} <targetclone> {heap 1392k} <opt_local_passes> {heap 1392k}during
GIMPLE pass: fre
j.c: In function 'foo':
j.c:9:1: internal compiler error: tree check: expected boolean_type or
enumeral_type or integer_type or bitint_type, have fixed_point_type in
visit_nary_op, at tree-ssa-sccvn.cc:6025
9 | }
| ^
0x2d15a3d internal_error(char const*, ...)
../../..//gcc/gcc/diagnostic-global-context.cc:787
0x1997b9a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../..//gcc/gcc/tree.cc:9394
0xb4dcb4 any_integral_type_check(tree_node*, char const*, int, char const*)
../../..//gcc/gcc/tree.h:4341
0x17f026d visit_nary_op
../../..//gcc/gcc/tree-ssa-sccvn.cc:6025
0x17f320a visit_stmt
../../..//gcc/gcc/tree-ssa-sccvn.cc:6858
0x17fa0c1 process_bb
../../..//gcc/gcc/tree-ssa-sccvn.cc:8724
[ ... ]
/* PR tree-optimization/81428 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
void
foo (long _Fract *a, long _Fract *b)
{
*b = *a / *a;
}
I'm not actively debugging this.