]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (gnat_to_gnu_param): Make sure an Out parameter with Default_Value aspect...
authorRobert Dewar <dewar@adacore.com>
Sat, 25 Jan 2014 10:34:40 +0000 (10:34 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 25 Jan 2014 10:34:40 +0000 (10:34 +0000)
* 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

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index f0cb5ee91cac8eee356521ff2390ba9fd06c9965..dceaa9995db72a514879f0c930252378afef6f1e 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-25  Robert Dewar  <dewar@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_param): Make sure an Out parameter
+       with Default_Value aspect is passed in by copy.
+
 2014-01-24  Eric Botcazou  <ebotcazou@adacore.com>
 
        * set_targ.adb: Set Short_Enums.
index c956d97a34ef45c3d3671563edabfdb0bc9d7c58..25e2e781cee0156259380df1ab6c95d3a9493bc3 100644 (file)
@@ -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)))))