aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-07-11 08:16:48 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-07-11 08:16:48 +0000
commit7352723b9e9a7f04d68aca3f09386d1a14c87f7e (patch)
treebc751dc234498dcd1192cf177d53d0f58422dcc5 /gcc/ada/gcc-interface/trans.c
parent833c1dbc609404a69b30d7f045b50935c058302b (diff)
downloadgcc-7352723b9e9a7f04d68aca3f09386d1a14c87f7e.zip
gcc-7352723b9e9a7f04d68aca3f09386d1a14c87f7e.tar.gz
gcc-7352723b9e9a7f04d68aca3f09386d1a14c87f7e.tar.bz2
trans.c (add_decl_expr): Minor tweak.
* gcc-interface/trans.c (add_decl_expr): Minor tweak. * gcc-interface/utils.c (create_var_decl): For an external variable, also clear TREE_READONLY in LTO mode if the initializer is not a valid constant and set DECL_READONLY_ONCE_ELAB instead. From-SVN: r238206
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index e237243..9d76fb9 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -8012,7 +8012,7 @@ void
add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
{
tree type = TREE_TYPE (gnu_decl);
- tree gnu_stmt, gnu_init, t;
+ tree gnu_stmt, gnu_init;
/* If this is a variable that Gigi is to ignore, we may have been given
an ERROR_MARK. So test for it. We also might have been given a
@@ -8059,15 +8059,6 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
&& !initializer_constant_valid_p (gnu_init,
TREE_TYPE (gnu_init)))))
{
- /* If GNU_DECL has a padded type, convert it to the unpadded
- type so the assignment is done properly. */
- if (TYPE_IS_PADDING_P (type))
- t = convert (TREE_TYPE (TYPE_FIELDS (type)), gnu_decl);
- else
- t = gnu_decl;
-
- gnu_stmt = build_binary_op (INIT_EXPR, NULL_TREE, t, gnu_init);
-
DECL_INITIAL (gnu_decl) = NULL_TREE;
if (TREE_READONLY (gnu_decl))
{
@@ -8075,6 +8066,12 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
DECL_READONLY_ONCE_ELAB (gnu_decl) = 1;
}
+ /* If GNU_DECL has a padded type, convert it to the unpadded
+ type so the assignment is done properly. */
+ if (TYPE_IS_PADDING_P (type))
+ gnu_decl = convert (TREE_TYPE (TYPE_FIELDS (type)), gnu_decl);
+
+ gnu_stmt = build_binary_op (INIT_EXPR, NULL_TREE, gnu_decl, gnu_init);
add_stmt_with_node (gnu_stmt, gnat_entity);
}
}