public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [fortran, patch, pr69659, v1] [6/7 Regression] ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get
@ 2016-05-22 16:51 Andre Vehreschild
  2016-06-05 12:05 ` Ping! " Andre Vehreschild
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-05-22 16:51 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Hi all,

attached patch fixes a regression that occurred on some testcases when
doing a validation run with -frepack-arrays. The issue here was that
for class arrays the array descriptor is in the _data component and not
directly at the address of the class_array. The patch fixes this issue
for pr69659 on trunk 7 and gcc-6-branch.

Ok for trunk and gcc-6?

Bootstrapped and regtested on x86_64-linux-gnu.

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: pr69659_1.patch --]
[-- Type: text/x-patch, Size: 1552 bytes --]

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 7be301d..403ce3a 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/gfortran.dg/class_array_22.f03 b/gcc/testsuite/gfortran.dg/class_array_22.f03
new file mode 100644
index 0000000..9410741
--- /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 <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
+

[-- Attachment #3: pr69659_1.clog --]
[-- Type: text/plain, Size: 383 bytes --]

gcc/testsuite/ChangeLog:

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

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


gcc/fortran/ChangeLog:

2016-05-22  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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ping!  [fortran, patch, pr69659, v1] [6/7 Regression] ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get
  2016-05-22 16:51 [fortran, patch, pr69659, v1] [6/7 Regression] ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get Andre Vehreschild
@ 2016-06-05 12:05 ` Andre Vehreschild
       [not found]   ` <CAGkQGiJ6KH+e_UyPe+=RwBOr1DGVhMpBDPHmNq_XZVpy3AXZFQ@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-06-05 12:05 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML

Ping!

On Sun, 22 May 2016 18:51:22 +0200
Andre Vehreschild <vehre@gmx.de> wrote:

> Hi all,
> 
> attached patch fixes a regression that occurred on some testcases when
> doing a validation run with -frepack-arrays. The issue here was that
> for class arrays the array descriptor is in the _data component and not
> directly at the address of the class_array. The patch fixes this issue
> for pr69659 on trunk 7 and gcc-6-branch.
> 
> Ok for trunk and gcc-6?
> 
> Bootstrapped and regtested on x86_64-linux-gnu.
> 
> Regards,
> 	Andre


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ping! [fortran, patch, pr69659, v1] [6/7 Regression] ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get
       [not found]     ` <20160605161310.68954abc@vepi2>
@ 2016-06-05 15:44       ` Paul Richard Thomas
  2016-06-05 18:10         ` Andre Vehreschild
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Richard Thomas @ 2016-06-05 15:44 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: fortran, gcc-patches

Hi Andre,

That's verging on 'obvious' and even does the job :-)

OK for trunk and 6-branch.

Thanks for the patch

Paul

On 5 June 2016 at 16:13, Andre Vehreschild <vehre@gmx.de> wrote:
> Hi Paul,
>
> now with attachment.
>
> - Andre
>
> On Sun, 5 Jun 2016 16:06:09 +0200
> Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:
>
>> Hi Andre,
>>
>> There's no attachment. Get it posted tonight and I will take a look at it.
>>
>> Cheers
>>
>> Paul
>>
>> On 5 June 2016 at 14:04, Andre Vehreschild <vehre@gmx.de> wrote:
>> > Ping!
>> >
>> > On Sun, 22 May 2016 18:51:22 +0200
>> > Andre Vehreschild <vehre@gmx.de> wrote:
>> >
>> >> Hi all,
>> >>
>> >> attached patch fixes a regression that occurred on some testcases when
>> >> doing a validation run with -frepack-arrays. The issue here was that
>> >> for class arrays the array descriptor is in the _data component and not
>> >> directly at the address of the class_array. The patch fixes this issue
>> >> for pr69659 on trunk 7 and gcc-6-branch.
>> >>
>> >> Ok for trunk and gcc-6?
>> >>
>> >> Bootstrapped and regtested on x86_64-linux-gnu.
>> >>
>> >> Regards,
>> >>       Andre
>> >
>> >
>> > --
>> > Andre Vehreschild * Email: vehre ad gmx dot de
>>
>>
>>
>
>
> --
> Andre Vehreschild * Email: vehre ad gmx dot de



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ping! [fortran, patch, pr69659, v1] [6/7 Regression] ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get
  2016-06-05 15:44       ` Paul Richard Thomas
@ 2016-06-05 18:10         ` Andre Vehreschild
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Vehreschild @ 2016-06-05 18:10 UTC (permalink / raw)
  To: Paul Richard Thomas; +Cc: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]

Hi Paul,

thanks for quick review. Comitted as r237105 for trunk. And r237107 for
branch-6.

Thanks again and regards,
	Andre

On Sun, 5 Jun 2016 17:44:19 +0200
Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:

> Hi Andre,
> 
> That's verging on 'obvious' and even does the job :-)
> 
> OK for trunk and 6-branch.
> 
> Thanks for the patch
> 
> Paul
> 
> On 5 June 2016 at 16:13, Andre Vehreschild <vehre@gmx.de> wrote:
> > Hi Paul,
> >
> > now with attachment.
> >
> > - Andre
> >
> > On Sun, 5 Jun 2016 16:06:09 +0200
> > Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:
> >  
> >> Hi Andre,
> >>
> >> There's no attachment. Get it posted tonight and I will take a look at it.
> >>
> >> Cheers
> >>
> >> Paul
> >>
> >> On 5 June 2016 at 14:04, Andre Vehreschild <vehre@gmx.de> wrote:  
> >> > Ping!
> >> >
> >> > On Sun, 22 May 2016 18:51:22 +0200
> >> > Andre Vehreschild <vehre@gmx.de> wrote:
> >> >  
> >> >> Hi all,
> >> >>
> >> >> attached patch fixes a regression that occurred on some testcases when
> >> >> doing a validation run with -frepack-arrays. The issue here was that
> >> >> for class arrays the array descriptor is in the _data component and not
> >> >> directly at the address of the class_array. The patch fixes this issue
> >> >> for pr69659 on trunk 7 and gcc-6-branch.
> >> >>
> >> >> Ok for trunk and gcc-6?
> >> >>
> >> >> Bootstrapped and regtested on x86_64-linux-gnu.
> >> >>
> >> >> Regards,
> >> >>       Andre  
> >> >
> >> >
> >> > --
> >> > Andre Vehreschild * Email: vehre ad gmx dot de  
> >>
> >>
> >>  
> >
> >
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de  
> 
> 
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: submit_trunk.diff --]
[-- Type: text/x-patch, Size: 2530 bytes --]

Index: gcc/testsuite/gfortran.dg/class_array_22.f03
===================================================================
--- gcc/testsuite/gfortran.dg/class_array_22.f03	(nicht existent)
+++ gcc/testsuite/gfortran.dg/class_array_22.f03	(Revision 237105)
@@ -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
+
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 237104)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -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.
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c	(Revision 237104)
+++ gcc/fortran/trans-array.c	(Arbeitskopie)
@@ -6386,7 +6386,12 @@
       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: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 237104)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -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

[-- Attachment #3: submit_gcc6.diff --]
[-- Type: text/x-patch, Size: 2452 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 237101)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -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-01  Paul Thomas  <pault@gcc.gnu.org>
 
 	PR fortran/71156
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c	(Revision 237101)
+++ gcc/fortran/trans-array.c	(Arbeitskopie)
@@ -6376,7 +6376,12 @@
       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: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 237101)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -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-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
 	PR target/70957
Index: gcc/testsuite/gfortran.dg/class_array_22.f03
===================================================================
--- gcc/testsuite/gfortran.dg/class_array_22.f03	(nicht existent)
+++ gcc/testsuite/gfortran.dg/class_array_22.f03	(Arbeitskopie)
@@ -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
+

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-05 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-22 16:51 [fortran, patch, pr69659, v1] [6/7 Regression] ICE on using option -frepack-arrays, in gfc_conv_descriptor_data_get Andre Vehreschild
2016-06-05 12:05 ` Ping! " Andre Vehreschild
     [not found]   ` <CAGkQGiJ6KH+e_UyPe+=RwBOr1DGVhMpBDPHmNq_XZVpy3AXZFQ@mail.gmail.com>
     [not found]     ` <20160605161310.68954abc@vepi2>
2016-06-05 15:44       ` Paul Richard Thomas
2016-06-05 18:10         ` Andre Vehreschild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).