]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Force
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2012 08:59:10 +0000 (08:59 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2012 08:59:10 +0000 (08:59 +0000)
BLKmode on the type if it is passed by reference.
<E_Array_Subtype>: Likewise.
<E_Record_Type>: Guard the call to Is_By_Reference_Type predicate.
<E_Record_Subtype>: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192673 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 570dc0fd15bf28ffd19497b9ce08902dd4f71edd..e330321e22cc922831e6df665d60f900bf863209 100644 (file)
@@ -1,3 +1,11 @@
+2012-10-22  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Force
+       BLKmode on the type if it is passed by reference.
+       <E_Array_Subtype>: Likewise.
+       <E_Record_Type>: Guard the call to Is_By_Reference_Type predicate.
+       <E_Record_Subtype>: Likewise.
+
 2012-10-22  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/utils.c (rest_of_record_type_compilation): Simplify and
index 3e0d733248797d1b4a7558f6ca967fd3f0df4342..dfefff2e7a71f9d897ef05b42ed4eaed72a427b3 100644 (file)
@@ -2248,6 +2248,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
            TYPE_MULTI_ARRAY_P (tem) = (index > 0);
            if (array_type_has_nonaliased_component (tem, gnat_entity))
              TYPE_NONALIASED_COMPONENT (tem) = 1;
+
+           /* If it is passed by reference, force BLKmode to ensure that
+              objects of this type will always be put in memory.  */
+           if (TYPE_MODE (tem) != BLKmode
+               && Is_By_Reference_Type (gnat_entity))
+             SET_TYPE_MODE (tem, BLKmode);
          }
 
        /* If an alignment is specified, use it if valid.  But ignore it
@@ -2588,6 +2594,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
              TYPE_MULTI_ARRAY_P (gnu_type) = (index > 0);
              if (array_type_has_nonaliased_component (gnu_type, gnat_entity))
                TYPE_NONALIASED_COMPONENT (gnu_type) = 1;
+
+             /* See the E_Array_Type case for the rationale.  */
+             if (TYPE_MODE (gnu_type) != BLKmode
+                 && Is_By_Reference_Type (gnat_entity))
+               SET_TYPE_MODE (gnu_type, BLKmode);
            }
 
          /* Attach the TYPE_STUB_DECL in case we have a parallel type.  */
@@ -3161,7 +3172,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
 
        /* If it is passed by reference, force BLKmode to ensure that objects
           of this type will always be put in memory.  */
-       if (Is_By_Reference_Type (gnat_entity))
+       if (TYPE_MODE (gnu_type) != BLKmode
+           && Is_By_Reference_Type (gnat_entity))
          SET_TYPE_MODE (gnu_type, BLKmode);
 
        /* We used to remove the associations of the discriminants and _Parent
@@ -3527,12 +3539,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
                 modify it below.  */
              finish_record_type (gnu_type, nreverse (gnu_field_list), 2,
                                  false);
+             compute_record_mode (gnu_type);
 
              /* See the E_Record_Type case for the rationale.  */
-             if (Is_By_Reference_Type (gnat_entity))
+             if (TYPE_MODE (gnu_type) != BLKmode
+                 && Is_By_Reference_Type (gnat_entity))
                SET_TYPE_MODE (gnu_type, BLKmode);
-             else
-               compute_record_mode (gnu_type);
 
              TYPE_VOLATILE (gnu_type) = Treat_As_Volatile (gnat_entity);