From: Andre Vehreschild Date: Sun, 5 Jun 2016 17:20:54 +0000 (+0200) Subject: re PR fortran/69659 (ICE on using option -frepack-arrays, in gfc_conv_descriptor_data... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2d83bd2c78021ed68b04c9d426925ef947dddaf;p=gcc.git re PR fortran/69659 (ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get) gcc/testsuite/ChangeLog: 2016-06-05 Andre Vehreschild PR fortran/69659 * gfortran.dg/class_array_22.f03: New test. gcc/fortran/ChangeLog: 2016-06-05 Andre Vehreschild 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8c04089f8d0..e6edc16ff19 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2016-06-05 Andre Vehreschild + + 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 * trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 7be301ddab8..403ce3a750d 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a552d3ad17..583a7cf9066 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-05 Andre Vehreschild + + PR fortran/69659 + * gfortran.dg/class_array_22.f03: New test. + 2016-06-05 Jan Hubicka * 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 index 00000000000..94107419b84 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_array_22.f03 @@ -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 +! Reduced by Janus Weil + + 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 +