aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-09-05 08:14:35 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-05 08:14:35 +0000
commitbabf697a2da6eff7ea91e02605023b309119a175 (patch)
tree3742a50e2cddae5fa2bd072065f1b69856d49bc9 /gcc/ada/gcc-interface
parent02e637d86f9ecb6d0e368438291bb6f6f8feb3ab (diff)
downloadgcc-babf697a2da6eff7ea91e02605023b309119a175.zip
gcc-babf697a2da6eff7ea91e02605023b309119a175.tar.gz
gcc-babf697a2da6eff7ea91e02605023b309119a175.tar.bz2
trans.c (pos_to_constructor): Skip conversions to an unconstrained array type.
* gcc-interface/trans.c (pos_to_constructor): Skip conversions to an unconstrained array type. From-SVN: r251691
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/trans.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 693c74f..f7b51bb 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -9826,7 +9826,14 @@ pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type,
gnat_component_type);
else
{
- gnu_expr = gnat_to_gnu (gnat_expr);
+ /* If the expression is a conversion to an unconstrained array type,
+ skip it to avoid spilling to memory. */
+ if (Nkind (gnat_expr) == N_Type_Conversion
+ && Is_Array_Type (Etype (gnat_expr))
+ && !Is_Constrained (Etype (gnat_expr)))
+ gnu_expr = gnat_to_gnu (Expression (gnat_expr));
+ else
+ gnu_expr = gnat_to_gnu (gnat_expr);
/* Before assigning the element to the array, make sure it is
in range. */