[Bug middle-end/126775] [17 Regression] ICE: tree check: expected real_cst, have vector_cst in generic_simplify_MINUS_EXPR, at generic-match-6.cc:7470 with -ffinite-math-only since r17-3158
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 20 08:33:13 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126775
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:579349b0f12681ffcbfd14eafe6efdc8da67a1f2
commit r17-3466-g579349b0f12681ffcbfd14eafe6efdc8da67a1f2
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Thu Aug 20 09:31:48 2026 +0100
PR middle-end/126775: ICE optimizing (T)0.0 - x with -ffinite-math-only
This patch fixes PR middle-end/126775, an ICE caused by my recent change
to match.pd around tweaking the conditions under which 0.0 - x can
safely be transformed into -x. Unfortunately, that change assumed
that real_zerop@0 implies that TREE_CODE(@0) == REAL_CST. Alas things
aren't that simple, so this fix introduces a new real_negzerop predicate
that in addition to REAL_CST also handles VECTOR_CST and COMPLEX_CST,
and most importantly fails gracefully on TREE_CODEs that it isn't
expecting.
2026-08-20 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR middle-end/126775
* match.pd (0.0 - x -> -x): Use new real_negzerop function.
* tree.cc (real_negzerop): New predicate function to test if
a tree expression is -0.0 or equivalent (like real_zerop).
* tree.h (real_negzerop): Prototype here.
gcc/testsuite/ChangeLog
PR middle-end/126775
* gcc.dg/pr126775.c: New test case.
More information about the Gcc-bugs
mailing list