re PR fortran/69659 (ICE on using option -frepack-arrays, in gfc_conv_descriptor_data...
authorAndre Vehreschild <vehre@gcc.gnu.org>
Sun, 5 Jun 2016 17:20:54 +0000 (19:20 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Sun, 5 Jun 2016 17:20:54 +0000 (19:20 +0200)
gcc/testsuite/ChangeLog:

2016-06-05  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/69659
* gfortran.dg/class_array_22.f03: New test.

gcc/fortran/ChangeLog:

2016-06-05  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/69659
* trans-array.c (gfc_trans_dummy_array_bias): For class arrays use
the address of the _data component to reference the arrays data
component.

From-SVN: r237105

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_array_22.f03 [new file with mode: 0644]

index 8c04089f8d02d6ff637da458a99750d2b1c4b35d..e6edc16ff19fca1cf23c8c6df02a30dcc01345dd 100644 (file)
@@ -1,3 +1,10 @@
+2016-06-05  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       PR fortran/69659
+       * trans-array.c (gfc_trans_dummy_array_bias): For class arrays use
+       the address of the _data component to reference the arrays data
+       component.
+
 2016-06-03  Chung-Lin Tang  <cltang@codesourcery.com>
 
        * trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable
index 7be301ddab8cf99e1969c7bd3c50d9a1164cc469..403ce3a750dd96d56768fe7992388d1e8ccb7ab4 100644 (file)
@@ -6386,7 +6386,12 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
       stmtCleanup = gfc_finish_block (&cleanup);
 
       /* Only do the cleanup if the array was repacked.  */
-      tmp = build_fold_indirect_ref_loc (input_location, dumdesc);
+      if (is_classarray)
+       /* For a class array the dummy array descriptor is in the _class
+          component.  */
+       tmp = gfc_class_data_get (dumdesc);
+      else
+       tmp = build_fold_indirect_ref_loc (input_location, dumdesc);
       tmp = gfc_conv_descriptor_data_get (tmp);
       tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
                             tmp, tmpdesc);
index 7a552d3ad17f6face931073696fcfcf07971bee7..583a7cf9066031542ac0aa19441b3a206d74eae7 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-05  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       PR fortran/69659
+       * gfortran.dg/class_array_22.f03: New test.
+
 2016-06-05  Jan Hubicka  <hubicka@ucw.cz>
 
        * gcc.dg/tree-prof/peel-1.c: Fix testcase.
diff --git a/gcc/testsuite/gfortran.dg/class_array_22.f03 b/gcc/testsuite/gfortran.dg/class_array_22.f03
new file mode 100644 (file)
index 0000000..9410741
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-frepack-arrays " }
+!
+! Original class_array_11.f03 but with -frepack-arrays a new
+! ICE was produced reported in
+! PR fortran/69659
+!
+! Original testcase by Ian Harvey <ian_harvey@bigpond.com>
+! Reduced by Janus Weil <Janus@gcc.gnu.org>
+
+  IMPLICIT NONE
+
+  TYPE :: ParentVector
+    INTEGER :: a
+  END TYPE ParentVector
+
+CONTAINS
+
+  SUBROUTINE vector_operation(pvec)
+    CLASS(ParentVector), INTENT(INOUT) :: pvec(:)
+    print *,pvec(1)%a
+  END SUBROUTINE
+
+END
+