aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 719b787..8c0cb1d 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8351,11 +8351,16 @@ fold_unary (enum tree_code code, tree type, tree op0)
mult_type = type;
else
mult_type = unsigned_type_for (type);
-
- tem = fold_build2 (MULT_EXPR, mult_type,
- fold_convert (mult_type, TREE_OPERAND (op0, 0)),
- fold_convert (mult_type, TREE_OPERAND (op0, 1)));
- return fold_convert (type, tem);
+
+ if (TYPE_PRECISION (mult_type) < TYPE_PRECISION (TREE_TYPE (op0)))
+ {
+ tem = fold_build2 (MULT_EXPR, mult_type,
+ fold_convert (mult_type,
+ TREE_OPERAND (op0, 0)),
+ fold_convert (mult_type,
+ TREE_OPERAND (op0, 1)));
+ return fold_convert (type, tem);
+ }
}
tem = fold_convert_const (code, type, op0);