diff options
author | trippels <trippels@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-30 07:07:55 +0000 |
---|---|---|
committer | trippels <trippels@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-30 07:07:55 +0000 |
commit | c76141f619ced6c2887182c80f0867471c5b8090 (patch) | |
tree | f7674b307aebc628adf661a398bf3c3a990f9d10 /gcc/data-streamer.c | |
parent | 191d50d7eb6831b8739b005e3256515e465a465c (diff) | |
download | gcc-c76141f619ced6c2887182c80f0867471c5b8090.tar.gz |
Fix signed integer overflow in data-streamer.c
Running the testsuite with a -fsanitize=undefined instrumented compiler
shows:
% gcc -O2 -flto -fno-use-linker-plugin -flto-partition=none testsuite/gcc.dg/torture/pr28045.c
gcc/data-streamer.c:113:45: runtime error: negation of -9223372036854775808 cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself
The fix is obvious.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215706 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/data-streamer.c')
-rw-r--r-- | gcc/data-streamer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/data-streamer.c b/gcc/data-streamer.c index 0e19c72162a..785beb5165f 100644 --- a/gcc/data-streamer.c +++ b/gcc/data-streamer.c @@ -110,7 +110,7 @@ bp_unpack_var_len_int (struct bitpack_d *bp) if ((half_byte & 0x8) == 0) { if ((shift < HOST_BITS_PER_WIDE_INT) && (half_byte & 0x4)) - result |= - ((HOST_WIDE_INT)1 << shift); + result |= - (HOST_WIDE_INT_1U << shift); return result; } |