re PR c/63862 (C frontend converts shift-count to int while standard wants integer...
authorMarek Polacek <polacek@redhat.com>
Fri, 28 Nov 2014 09:06:48 +0000 (09:06 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 28 Nov 2014 09:06:48 +0000 (09:06 +0000)
commit541e35a6a3f8ca2d9877ea6c477e765e1d0a9497
tree4f8a839fa82870468359fe7d2e0ca156c9cfa4ef
parent7e015fcefe33eded9a565e7e2ad3da11952249ae
re PR c/63862 (C frontend converts shift-count to int while standard wants integer promotions)

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.

From-SVN: r218142
gcc/c-family/ChangeLog
gcc/c-family/c-gimplify.c
gcc/c-family/c-ubsan.c
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/shift-7.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c