https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306

--- Comment #10 from Andrew Macleod <amacleod at redhat dot com> ---
Created attachment 54286
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54286&action=edit
proposed patch

There is a bug in the implementation of range-ops for shifts when the shift is
guaranteed to be out of range.

get_shift_range() calculates what the valid part of op2 is for a shift, but
instead of returning true when the result is undefined, it returns FALSE.  THe
fold routine interprets a false value to mean it can't extract a range at all,
and then defaults to either UNDEFINED or VARYING depending on the value of op2.

With this patch, we cfix that and return 0 for both rshift and lshift when the
possible values are out of range.  This causes the testcase as specified to
issue no warnings at all.  is that correct?  See if this fixes your issue.

I'll run this thru testing shortly.

Reply via email to