diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-01-12 22:39:49 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-01-12 22:39:49 +0000 |
commit | 52ef2874d251e7aafa267b9eaf9d5c6b24d29f4b (patch) | |
tree | 9fbe6956653b449d127488655bf8fc317363e50d /gcc/ada | |
parent | a60b56a48842de242a7d71cb32bcf5b9e0482e4a (diff) | |
download | gcc-52ef2874d251e7aafa267b9eaf9d5c6b24d29f4b.zip gcc-52ef2874d251e7aafa267b9eaf9d5c6b24d29f4b.tar.gz gcc-52ef2874d251e7aafa267b9eaf9d5c6b24d29f4b.tar.bz2 |
re PR ada/33788 (GNAT bug box in expand_expr_addr_expr_1, at expr.c:6862)
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.
From-SVN: r131493
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/ada/utils.c | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4dfdde6..7b1745c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2008-01-12 Eric Botcazou <ebotcazou@adacore.com> + + * utils.c (unchecked_convert): Fold the VIEW_CONVERT_EXPR expression. + 2008-01-10 John David Anglin <dave.anglin.@nrc-cnrc.gc.ca> PR ada/34466 diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index a82cc79..f34816b 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 |