summaryrefslogtreecommitdiffstats
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-23 06:43:56 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-23 06:43:56 +0000
commit9e072631954f2a99c0e65ea3ebb59a9e83594422 (patch)
tree15e99879c42bf7c05a952c82b854878e4a17c80d /gcc/c-typeck.c
parent21d9004815270f0f4b819229a47eadd5fc692000 (diff)
downloadppe42-gcc-9e072631954f2a99c0e65ea3ebb59a9e83594422.tar.gz
ppe42-gcc-9e072631954f2a99c0e65ea3ebb59a9e83594422.zip
PR c/39779
* c-typeck.c (build_binary_op) <short_shift>: Check that integer constant is more than zero. testsuite/ChangeLog: PR c/39779 * gcc.c-torture/compile/pr39779.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152058 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 411b9ec2aa2..1b2b8585823 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -9465,6 +9465,7 @@ build_binary_op (location_t location, enum tree_code code,
unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0));
if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
+ && tree_int_cst_sgn (op1) > 0
/* We can shorten only if the shift count is less than the
number of bits in the smaller type size. */
&& compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0
OpenPOWER on IntegriCloud