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 <[email protected]>: https://gcc.gnu.org/g:579349b0f12681ffcbfd14eafe6efdc8da67a1f2 commit r17-3466-g579349b0f12681ffcbfd14eafe6efdc8da67a1f2 Author: Roger Sayle <[email protected]> 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 <[email protected]> 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.
