diff options
author | Eric Botcazou <ebotcazou@act-europe.fr> | 2004-10-27 15:55:45 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-10-27 15:55:45 +0200 |
commit | 04061aa5af34837ef99383b2a481aaff033cbc4c (patch) | |
tree | 1582017d854c6cbefd872bdc899ce8c545b518ff /gcc | |
parent | b194546ef03e4ed7a88c3fb4850c72290e10c234 (diff) | |
download | gcc-04061aa5af34837ef99383b2a481aaff033cbc4c.zip gcc-04061aa5af34837ef99383b2a481aaff033cbc4c.tar.gz gcc-04061aa5af34837ef99383b2a481aaff033cbc4c.tar.bz2 |
trans.c (call_to_gnu): For an (in-)out parameter passed by reference whose type is a constructed...
2004-10-26 Eric Botcazou <ebotcazou@act-europe.fr>
* trans.c (call_to_gnu): For an (in-)out parameter passed by reference
whose type is a constructed subtype of an aliased object with an
unconstrained nominal subtype, convert the actual to the constructed
subtype before taking its address.
From-SVN: r89676
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/trans.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 666f84e2..4f04da7 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -1759,6 +1759,20 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) && TREE_CODE (gnu_actual) != SAVE_EXPR) gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)), gnu_actual); + + /* If we have the constructed subtype of an aliased object + with an unconstrained nominal subtype, the type of the + actual includes the template, although it is formally + constrained. So we need to convert it back to the real + constructed subtype to retrieve the constrained part + and takes its address. */ + if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE + && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (gnu_actual)) + && TREE_CODE (gnu_actual) != SAVE_EXPR + && Is_Constr_Subt_For_UN_Aliased (Etype (gnat_actual)) + && Is_Array_Type (Etype (gnat_actual))) + gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)), + gnu_actual); } /* Otherwise, if we have a non-addressable COMPONENT_REF of a |