On Sat, 21 Nov 2015, Richard Biener wrote:
On November 20, 2015 8:58:15 PM GMT+01:00, Jason Merrill <ja...@redhat.com>
wrote:
In this bug, we hit the (A & sign-bit) != 0 -> A < 0 transformation.
Because of delayed folding, the operands aren't fully folded yet, so we
have NOP_EXPRs around INTEGER_CSTs, and so calling wi::only_sign_bit_p
ICEs. We've been seeing several similar bugs, where code calls
integer_zerop and therefore assumes that they have an INTEGER_CST, but
in fact integer_zerop does STRIP_NOPS.
This patch changes the pattern to only match if the operand is actually
an INTEGER_CST. Alternatively we could call tree_strip_nop_conversions
on the operand, but I would expect that to have issues when the
conversion changes the signedness of the type.
OK if testing passes?
What happens if we remove the nops stripping from integer_zerop?
I had the same reaction.
Do other integer predicates strip nops?
Yes, they do.
I believe I added one or two of those, and the reason I added STRIP_NOPS
is because they started as a copy-paste of integer_zerop...
--
Marc Glisse