[Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 28 09:07:00 GMT 2014


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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Nov 28 09:06:48 2014
New Revision: 218142

URL: https://gcc.gnu.org/viewcvs?rev=218142&root=gcc&view=rev
Log:
    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.

Added:
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-7.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-gimplify.c
    trunk/gcc/c-family/c-ubsan.c
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c



More information about the Gcc-bugs mailing list