aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-07-18 19:02:49 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-07-18 19:02:49 -0400
commit410d3f5de9e750be1a08b252a543c7b9c5577d34 (patch)
treeb5ab00a485b8808fc97b5299212b6bc8c9e9f0d5 /gcc
parent56a9868e9e0b537edf26383343b78a93eae418b4 (diff)
downloadgcc-410d3f5de9e750be1a08b252a543c7b9c5577d34.zip
gcc-410d3f5de9e750be1a08b252a543c7b9c5577d34.tar.gz
gcc-410d3f5de9e750be1a08b252a543c7b9c5577d34.tar.bz2
(fold, case CONVERT_EXPR): Don't merge conversions if outer is to
handle a type with differing precision. From-SVN: r10145
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 4c86dac..8c35dc4 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3445,11 +3445,14 @@ fold (expr)
float or both integer, we don't need the middle conversion if
it is wider than the final type and doesn't change the signedness
(for integers). Avoid this if the final type is a pointer
- since then we sometimes need the inner conversion. */
+ since then we sometimes need the inner conversion. Likewise if
+ the outer has a precision not equal to the size of its mode. */
if ((((inter_int || inter_ptr) && (inside_int || inside_ptr))
|| (inter_float && inside_float))
&& inter_prec >= inside_prec
&& (inter_float || inter_unsignedp == inside_unsignedp)
+ && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
+ && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
&& ! final_ptr)
return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0));
@@ -3471,7 +3474,10 @@ fold (expr)
&& ((inter_unsignedp && inter_prec > inside_prec)
== (final_unsignedp && final_prec > inter_prec))
&& ! (inside_ptr && inter_prec != final_prec)
- && ! (final_ptr && inside_prec != inter_prec))
+ && ! (final_ptr && inside_prec != inter_prec)
+ && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
+ && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
+ && ! final_ptr)
return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0));
}