https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114666
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- With match.pd:7103 disable we get: Folding statement: _2 = (long unsigned int) _1; Global Exported: _2 = [irange] long unsigned int [0, 0][+INF, +INF] Not folded Folding statement: _3 = _2 ^ 1; Matching expression match.pd:2835, gimple-match-2.cc:35 Matching expression match.pd:2838, gimple-match-1.cc:66 Matching expression match.pd:2845, gimple-match-2.cc:96 Matching expression match.pd:2243, gimple-match-5.cc:20 Matching expression match.pd:2835, gimple-match-2.cc:35 Matching expression match.pd:2838, gimple-match-1.cc:66 Matching expression match.pd:2845, gimple-match-2.cc:96 Applying pattern match.pd:6795, gimple-match-4.cc:1721 Matching expression match.pd:2243, gimple-match-5.cc:20 Matching expression match.pd:2286, gimple-match-3.cc:23 Matching expression match.pd:2255, gimple-match-4.cc:67 Matching expression match.pd:2243, gimple-match-5.cc:20 Applying pattern match.pd:5898, gimple-match-7.cc:51777 gimple_simplified to _3 = _1 ? 18446744073709551614 : 1; Global Exported: _3 = [irange] long unsigned int [1, 1][18446744073709551614, 18446744073709551614] Folded into: _3 = _1 ? 18446744073709551614 : 1; But _1 here is an 1bit signed integer which I am 100% sure is really invalid gimple but we don't reject it. We don't check the operand 0 for COND_EXPR in verify_gimple_assign_ternary at all .....