aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@cygnus.com>2000-05-24 18:24:06 +0000
committerNick Clifton <nickc@gcc.gnu.org>2000-05-24 18:24:06 +0000
commitd08230fe7def51b5ff3abfd4bde7da222989aa6c (patch)
tree96df4fe16b6a8a7bb9b22654c0440baf2fc77f11 /gcc/fold-const.c
parent3c7673a5970950c685a3d962a4157cf519d931a6 (diff)
downloadgcc-d08230fe7def51b5ff3abfd4bde7da222989aa6c.zip
gcc-d08230fe7def51b5ff3abfd4bde7da222989aa6c.tar.gz
gcc-d08230fe7def51b5ff3abfd4bde7da222989aa6c.tar.bz2
(extract_muldiv): When constructing a multiplier/divisor...
(extract_muldiv): When constructing a multiplier/divisor, do not expect const_binop to correctly determine if overflow has occured, so check explicitly. From-SVN: r34135
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 12a8d1a..eec3bc4 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4451,6 +4451,10 @@ extract_muldiv (t, c, code, wide_type)
or floor division, by a power of two, so we can treat it that
way unless the multiplier or divisor overflows. */
if (TREE_CODE (op1) == INTEGER_CST
+ /* const_binop may not detect overflow correctly,
+ so check for it explicitly here. */
+ && TYPE_PRECISION (TREE_TYPE (size_one_node)) > TREE_INT_CST_LOW (op1)
+ && TREE_INT_CST_HIGH (op1) == 0
&& 0 != (t1 = convert (ctype,
const_binop (LSHIFT_EXPR, size_one_node,
op1, 0)))