On Thu, Nov 27, 2014 at 08:24:03PM +0100, Marek Polacek wrote:
> On Thu, Nov 27, 2014 at 10:56:06AM +0100, Richard Biener wrote:
> > But then rather than using integer_type_node I'd convert to
> > unsigned_type_node (if that doesn't work you know we have some nasty
> > dependence on negative shift counts "working")
> 
> Yeah, I think adding the conversion into c_gimplify_expr is the best
> thing we can do until we have type demotion/promotion pass.  Seems
> that unsigned_type_node there works well.
> (What happened to Kai's type elevation pass?)
> 
> Bootstrapped/regtested on ppc64-linux, ok for trunk?

LGTM.

> 2014-11-27  Marek Polacek  <pola...@redhat.com>
> 
>       PR c/63862
> c-family/
>       * c-ubsan.c (ubsan_instrument_shift): Change the type of a MINUS_EXPR
>       to op1_utype.
>       * c-gimplify.c (c_gimplify_expr): Convert right operand of a shift
>       expression to unsigned_type_node.
> c/
>       * c-typeck.c (build_binary_op) <RSHIFT_EXPR, LSHIFT_EXPR>: Don't
>       convert the right operand to integer type.
> cp/
>       * typeck.c (cp_build_binary_op) <RSHIFT_EXPR, LSHIFT_EXPR>: Don't
>       convert the right operand to integer type.
> testsuite/
>       * gcc.c-torture/execute/shiftopt-1.c: Don't XFAIL anymore.
>       * c-c++-common/ubsan/shift-7.c: New test.

        Jakub

Reply via email to