diff options
author | Marek Polacek <polacek@redhat.com> | 2014-11-28 09:06:48 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-11-28 09:06:48 +0000 |
commit | 541e35a6a3f8ca2d9877ea6c477e765e1d0a9497 (patch) | |
tree | 4f8a839fa82870468359fe7d2e0ca156c9cfa4ef /gcc/c | |
parent | 7e015fcefe33eded9a565e7e2ad3da11952249ae (diff) | |
download | gcc-541e35a6a3f8ca2d9877ea6c477e765e1d0a9497.zip gcc-541e35a6a3f8ca2d9877ea6c477e765e1d0a9497.tar.gz gcc-541e35a6a3f8ca2d9877ea6c477e765e1d0a9497.tar.bz2 |
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
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 10 |
2 files changed, 6 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e2a9630..0f42b10 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2014-11-28 Marek Polacek <polacek@redhat.com> + + PR c/63862 + * c-typeck.c (build_binary_op) <RSHIFT_EXPR, LSHIFT_EXPR>: Don't + convert the right operand to integer type. + 2014-11-25 Marek Polacek <polacek@redhat.com> PR c/63877 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 67efb46..bf0f306 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -10513,11 +10513,6 @@ build_binary_op (location_t location, enum tree_code code, /* Use the type of the value to be shifted. */ result_type = type0; - /* Convert the non vector shift-count to an integer, regardless - of size of value being shifted. */ - if (TREE_CODE (TREE_TYPE (op1)) != VECTOR_TYPE - && TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = convert (integer_type_node, op1); /* Avoid converting op1 to result_type later. */ converted = 1; } @@ -10563,11 +10558,6 @@ build_binary_op (location_t location, enum tree_code code, /* Use the type of the value to be shifted. */ result_type = type0; - /* Convert the non vector shift-count to an integer, regardless - of size of value being shifted. */ - if (TREE_CODE (TREE_TYPE (op1)) != VECTOR_TYPE - && TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = convert (integer_type_node, op1); /* Avoid converting op1 to result_type later. */ converted = 1; } |