From 54805e134f0eacc458edae67f2dfde22f0f73e32 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 15 Jul 2004 03:17:42 +0000 Subject: [PATCH] trans.c (add_decl_expr): Clear TREE_READONLY if clear DECL_INITIAL. * trans.c (add_decl_expr): Clear TREE_READONLY if clear DECL_INITIAL. * utils.c (unchecked_convert): Don't do two VIEW_CONVERT_EXPRs. From-SVN: r84742 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/trans.c | 1 + gcc/ada/utils.c | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 82315c981e3..5ad44ea54c0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 14 23:16:59 2004 Richard Kenner + + * trans.c (add_decl_expr): Clear TREE_READONLY if clear DECL_INITIAL. + * utils.c (unchecked_convert): Don't do two VIEW_CONVERT_EXPRs. + 2004-07-14 Andreas Schwab * trans.c (gnat_init_stmt_group): Remove duplicate definition. diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 0cc6f953fe6..903b314477a 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -4164,6 +4164,7 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity) gnu_lhs, DECL_INITIAL (gnu_decl)); DECL_INITIAL (gnu_decl) = 0; + TREE_READONLY (gnu_decl) = 0; annotate_with_locus (gnu_assign_stmt, DECL_SOURCE_LOCATION (gnu_decl)); add_stmt (gnu_assign_stmt); diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index dc8a5b129f8..3d525a07b7c 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -3224,6 +3224,11 @@ unchecked_convert (tree type, tree expr, int 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); } -- 2.30.2