diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2012-05-18 20:33:49 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2012-05-18 20:33:49 +0000 |
commit | 1d5bfe9720e54fa5b723046046b4a150b1f982e7 (patch) | |
tree | 09b3a596144a94ed903755fd076214a442084a3c /gcc/ada/gcc-interface/decl.c | |
parent | b8b552d99b245b79f9969cecf38619f8183591f6 (diff) | |
download | gcc-1d5bfe9720e54fa5b723046046b4a150b1f982e7.zip gcc-1d5bfe9720e54fa5b723046046b4a150b1f982e7.tar.gz gcc-1d5bfe9720e54fa5b723046046b4a150b1f982e7.tar.bz2 |
decl.c (gnat_to_gnu_entity): For an object at global level with unconstrained nominal subtype and a...
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: For an object at
global level with unconstrained nominal subtype and a non-fixed size,
make a variable for the size.
From-SVN: r187666
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 97ade5e..bb36269 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -760,6 +760,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_size = max_size (TYPE_SIZE (gnu_type), true); mutable_p = true; } + + /* If we are at global level and the size isn't constant, call + elaborate_expression_1 to make a variable for it rather than + calculating it each time. */ + if (global_bindings_p () && !TREE_CONSTANT (gnu_size)) + gnu_size = elaborate_expression_1 (gnu_size, gnat_entity, + get_identifier ("SIZE"), + definition, false); } /* If the size is zero byte, make it one byte since some linkers have |