https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127057
Jin Xu <jinxu0609 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jinxu0609 at gmail dot com
--- Comment #2 from Jin Xu <jinxu0609 at gmail dot com> ---
The ICE seems to come from pointer_int_sum calling TREE_OVERFLOW on the
as-yet-unconverted MULT_EXPR result after it scales the integer operand. The
thing is, TREE_OVERFLOW only works on constants, but here the index is still a
BIT_AND_EXPR – something like (overflowed constant) & (... != c). So the
checking build dies with "expected class 'constant', have 'binary'
(bit_and_expr)".
Meanwhile, the surrounding code already uses TREE_OVERFLOW_P on the converted
operand, which is the safe, class-checking macro. So using plain TREE_OVERFLOW
on t looks inconsistent. My guess is that swapping those TREE_OVERFLOW (t)
checks for TREE_OVERFLOW_P (t) (there are a few copies in the plus/minus
distribution path too) would avoid the ICE without changing the intended logic
– which is to drop overflow flags that only appeared after the sizetype
conversion, while keeping the flag for true constants.