https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100925
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:d4faa36e7540c573c5dc17850bcd938d0900b2e9 commit r12-1349-gd4faa36e7540c573c5dc17850bcd938d0900b2e9 Author: Andrew Pinski <apin...@marvell.com> Date: Sat Jun 5 21:25:58 2021 -0700 Fix PR 100925: Limit some a?CST1:CST2 optimizations to intergal types only The problem here is with offset (and pointer) types is we produce a negative expression when this optimization hits. It is easier to disable this optimization for all non-integeral types instead of finding an integer type which is the same precission as the type to do the negative expression on it. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/100925 * match.pd (a ? CST1 : CST2): Limit transformations that would produce a negative to integeral types only. Change !POINTER_TYPE_P to INTEGRAL_TYPE_P also. gcc/testsuite/ChangeLog: * g++.dg/torture/pr100925.C: New test.