summaryrefslogtreecommitdiff
path: root/gcc/ada/utils.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-12 22:39:49 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-12 22:39:49 +0000
commit134ae6135511f464d5f92848959581ad64f1d36e (patch)
tree9fbe6956653b449d127488655bf8fc317363e50d /gcc/ada/utils.c
parentf9f517cc36ca66e2fd4b51d6d179479f252051df (diff)
downloadgcc-134ae6135511f464d5f92848959581ad64f1d36e.tar.gz
PR ada/33788
* fold-const.c (fold_unary) <VIEW_CONVERT_EXPR>: Fold an existing NOP_EXPR if it is between integral types with the same precision. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131493 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/utils.c')
-rw-r--r--gcc/ada/utils.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index a82cc79cd65..f34816b09d6 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -3842,8 +3842,8 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
expr = convert (rtype, expr);
if (type != rtype)
- expr = build1 (final_unchecked ? VIEW_CONVERT_EXPR : NOP_EXPR,
- type, expr);
+ expr = fold_build1 (final_unchecked ? VIEW_CONVERT_EXPR : NOP_EXPR,
+ type, expr);
}
/* If we are converting TO an integral type whose precision is not the
@@ -3894,13 +3894,8 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
else
{
expr = maybe_unconstrained_array (expr);
-
- /* There's no point in doing two unchecked conversions in a row. */
- if (TREE_CODE (expr) == VIEW_CONVERT_EXPR)
- expr = TREE_OPERAND (expr, 0);
-
etype = TREE_TYPE (expr);
- expr = build1 (VIEW_CONVERT_EXPR, type, expr);
+ expr = fold_build1 (VIEW_CONVERT_EXPR, type, expr);
}
/* If the result is an integral type whose size is not equal to