diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-06-19 20:10:50 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-06-19 20:10:50 +0000 |
commit | b24f7345365c9faea98acfb1e145f3efe943f8d1 (patch) | |
tree | 57fbd1f7dca579febe84e8afbe2f72fa7d1e432f /gcc/ada/gcc-interface/decl.c | |
parent | 1539357d45345b583fa613b79e9ccdc35de0527b (diff) | |
download | gcc-b24f7345365c9faea98acfb1e145f3efe943f8d1.zip gcc-b24f7345365c9faea98acfb1e145f3efe943f8d1.tar.gz gcc-b24f7345365c9faea98acfb1e145f3efe943f8d1.tar.bz2 |
decl.c (gnat_to_gnu_entity): Make sure the size of a padding type built around the return type is positive.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Make sure
the size of a padding type built around the return type is positive.
* gcc-interface/trans.c (gnat_to_gnu) <N_Simple_Return_Statement>:
Use INIT_EXPR instead of MODIFY_EXPR to assign to the return object.
From-SVN: r224697
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index a17eab6..f487e9b 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4242,12 +4242,23 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_return_type))) { tree orig_type = gnu_return_type; + tree max_return_size + = max_size (TYPE_SIZE (gnu_return_type), true); + + /* If the size overflows to 0, set it to an arbitrary positive + value so that assignments in the type are preserved. Their + actual size is independent of this positive value. */ + if (TREE_CODE (max_return_size) == INTEGER_CST + && TREE_OVERFLOW (max_return_size) + && integer_zerop (max_return_size)) + { + max_return_size = copy_node (bitsize_unit_node); + TREE_OVERFLOW (max_return_size) = 1; + } gnu_return_type - = maybe_pad_type (gnu_return_type, - max_size (TYPE_SIZE (gnu_return_type), - true), - 0, gnat_entity, false, false, definition, + = maybe_pad_type (gnu_return_type, max_return_size, 0, + gnat_entity, false, false, definition, true); /* Declare it now since it will never be declared otherwise. |