diff options
author | Robert Dewar <dewar@adacore.com> | 2014-01-25 10:34:40 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2014-01-25 10:34:40 +0000 |
commit | 3a70ba74892db2bfdf273248171b541e588d0ee8 (patch) | |
tree | 2a572fd390b966e11256c72919acbb54fb61a6ef /gcc/ada/gcc-interface/decl.c | |
parent | 0c9d009cbf817ed852c7ffa47964604d8f3ba9ba (diff) | |
download | gcc-3a70ba74892db2bfdf273248171b541e588d0ee8.zip gcc-3a70ba74892db2bfdf273248171b541e588d0ee8.tar.gz gcc-3a70ba74892db2bfdf273248171b541e588d0ee8.tar.bz2 |
decl.c (gnat_to_gnu_param): Make sure an Out parameter with Default_Value aspect is passed in by copy.
* gcc-interface/decl.c (gnat_to_gnu_param): Make sure an Out parameter
with Default_Value aspect is passed in by copy.
From-SVN: r207071
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index c956d97..25e2e78 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5842,7 +5842,8 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, Out parameters with discriminants or implicit initial values to be handled like In Out parameters. These type are normally built as aggregates, hence passed by reference, except for some packed arrays - which end up encoded in special integer types. + which end up encoded in special integer types. Note that scalars can + be given implicit initial values using the Default_Value aspect. The exception we need to make is then for packed arrays of records with discriminants or implicit initial values. We have no light/easy @@ -5856,7 +5857,8 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, || (mech != By_Descriptor && mech != By_Short_Descriptor && !POINTER_TYPE_P (gnu_param_type) - && !AGGREGATE_TYPE_P (gnu_param_type))) + && !AGGREGATE_TYPE_P (gnu_param_type) + && !Has_Default_Aspect (Etype (gnat_param)))) && !(Is_Array_Type (Etype (gnat_param)) && Is_Packed (Etype (gnat_param)) && Is_Composite_Type (Component_Type (Etype (gnat_param))))) |