diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-08-13 14:39:54 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-08-13 14:39:54 +0200 |
commit | eb87c7c4890b87d5f228b9261c2e3b3a5b81acd7 (patch) | |
tree | ad4832638401fe5e5c7f1ec4cd85012761658f24 /gcc/stor-layout.c | |
parent | 6a9573cc7b1d527e61f4ef7900c0a1c21203e24a (diff) | |
download | gcc-eb87c7c4890b87d5f228b9261c2e3b3a5b81acd7.zip gcc-eb87c7c4890b87d5f228b9261c2e3b3a5b81acd7.tar.gz gcc-eb87c7c4890b87d5f228b9261c2e3b3a5b81acd7.tar.bz2 |
re PR c/53968 (integer undefined behaviors in GCC)
PR c/53968
* tree.c (integer_pow2p): Avoid undefined signed overflows.
* simplify-rtx.c (neg_const_int): Likewise.
* expr.c (fixup_args_size_notes): Likewise.
* stor-layout.c (set_min_and_max_values_for_integral_type): Likewise.
* double-int.c (mul_double_wide_with_sign): Likewise.
(double_int_mask): Likewise.
* tree-ssa-loop-ivopts.c (get_address_cost): Likewise.
From-SVN: r190342
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index ddec141..53554a9 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1,7 +1,7 @@ /* C-compiler utilities for types and variables storage layout Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011 Free Software Foundation, Inc. + 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -2568,10 +2568,14 @@ set_min_and_max_values_for_integral_type (tree type, = build_int_cst_wide (type, (precision - HOST_BITS_PER_WIDE_INT > 0 ? -1 - : ((HOST_WIDE_INT) 1 << (precision - 1)) - 1), + : (HOST_WIDE_INT) + (((unsigned HOST_WIDE_INT) 1 + << (precision - 1)) - 1)), (precision - HOST_BITS_PER_WIDE_INT - 1 > 0 - ? (((HOST_WIDE_INT) 1 - << (precision - HOST_BITS_PER_WIDE_INT - 1))) - 1 + ? (HOST_WIDE_INT) + ((((unsigned HOST_WIDE_INT) 1 + << (precision - HOST_BITS_PER_WIDE_INT + - 1))) - 1) : 0)); } |