aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2004-08-03 21:24:32 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2004-08-03 21:24:32 +0000
commita0fac73d2b6a463a96c93d8ea37d1c33e605aa93 (patch)
tree0b16b01e23d9aa185acb22cc027765bf8cef2029 /gcc/fold-const.c
parent5357b1f9df2a6613d463096a8808f34a4ee6f60e (diff)
downloadgcc-a0fac73d2b6a463a96c93d8ea37d1c33e605aa93.zip
gcc-a0fac73d2b6a463a96c93d8ea37d1c33e605aa93.tar.gz
gcc-a0fac73d2b6a463a96c93d8ea37d1c33e605aa93.tar.bz2
re PR middle-end/16790 (Integer down cast ignored in larger expression)
PR middle-end/16790 * fold-const.c (extract_muldiv_1) <NOP_EXPR>: Disallow local truncations, not just global truncations. * gcc.c-torture/execute/pr16790-1.c: New test case. From-SVN: r85506
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f4a6fb0..503b6f0 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5102,9 +5102,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type)
&& TYPE_IS_SIZETYPE (TREE_TYPE (op0)))
&& (GET_MODE_SIZE (TYPE_MODE (ctype))
> GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0)))))
- /* ... or its type is larger than ctype,
- then we cannot pass through this truncation. */
- || (GET_MODE_SIZE (TYPE_MODE (ctype))
+ /* ... or this is a truncation (t is narrower than op0),
+ then we cannot pass through this narrowing. */
+ || (GET_MODE_SIZE (TYPE_MODE (type))
< GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0))))
/* ... or signedness changes for division or modulus,
then we cannot pass through this conversion. */