public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] Fix part of PR 71066
@ 2019-02-10 11:13 Thomas Koenig
  2019-02-16 13:34 ` *ping* " Thomas Koenig
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2019-02-10 11:13 UTC (permalink / raw)
  To: fortran, gcc-patches

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

Hello world,

this patch fixes the coarray part of PR 71066 - handling of data
statements for coarrays.  The PR itself is marked as a 7/8/9
regression.

Regression-tested.  OK for trunk and for backporting?

Regards

	Thomas

2019-02-10  Thomas Koenig  <tkoenig@gcc.gnu.org> 

 

         PR fortran/71066 

         * trans-decl.c (generate_coarray_sym_init):  For an array 

         constructor in a DATA statement of a coarray variable, set the 

         rank to 1 to avoid confusion later on.  If the constructor 

         contains only one value, use that for initiailizig. 

 

2019-02-10  Thomas Koenig  <tkoenig@gcc.gnu.org> 

 

         PR fortran/71066 

         * gfortran.dg/coarray_data_1.f90: New test.

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

Index: trans-decl.c
===================================================================
--- trans-decl.c	(Revision 268432)
+++ trans-decl.c	(Arbeitskopie)
@@ -5399,6 +5399,33 @@ generate_coarray_sym_init (gfc_symbol *sym)
   /* Handle "static" initializer.  */
   if (sym->value)
     {
+      if (sym->value->expr_type == EXPR_ARRAY)
+	{
+	  gfc_constructor *c, *cnext;
+
+	  /* Test if the array has more than one element.  */
+	  c = gfc_constructor_first (sym->value->value.constructor);
+	  gcc_assert (c);  /* Empty constructor should not happen here.  */
+	  cnext = gfc_constructor_next (c);
+
+	  if (cnext)
+	    {
+	      /* An EXPR_ARRAY with a rank > 1 here has to come from a
+		 DATA statement.  Set its rank here as not to confuse
+		 the following steps.   */
+	      sym->value->rank = 1;
+	    }
+	  else
+	    {
+	      /* There is only a single value in the constructor, use
+		 it directly for the assignment.  */
+	      gfc_expr *new_expr;
+	      new_expr = gfc_copy_expr (c->expr);
+	      gfc_free_expr (sym->value);
+	      sym->value = new_expr;
+	    }
+	}
+
       sym->attr.pointer = 1;
       tmp = gfc_trans_assignment (gfc_lval_expr_from_sym (sym), sym->value,
 				  true, false);

[-- Attachment #3: coarray_data_1.f90 --]
[-- Type: text/x-fortran, Size: 302 bytes --]

! { dg-do  run }
! { dg-options "-fcoarray=lib -lcaf_single " }
! PR 71066 - this used to ICE
program p
   real :: a(2,2)[*]
   integer :: b(2,2)[*]
   data a /4*0.0/
   data b /1234, 2345, 3456, 4567/
   if (any (a /= 0.0)) stop 1
   if (any (b /= reshape([1234, 2345, 3456, 4567],[2,2]))) stop 2
end

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

* *ping* [patch, fortran] Fix part of PR 71066
  2019-02-10 11:13 [patch, fortran] Fix part of PR 71066 Thomas Koenig
@ 2019-02-16 13:34 ` Thomas Koenig
  2019-02-16 16:06   ` Janne Blomqvist
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2019-02-16 13:34 UTC (permalink / raw)
  To: fortran, gcc-patches

Am 10.02.19 um 12:13 schrieb Thomas Koenig:
> Hello world,
> 
> this patch fixes the coarray part of PR 71066 - handling of data
> statements for coarrays.  The PR itself is marked as a 7/8/9
> regression.
> 
> Regression-tested.  OK for trunk and for backporting?

Ping?

Regards

	Thomas

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

* Re: *ping* [patch, fortran] Fix part of PR 71066
  2019-02-16 13:34 ` *ping* " Thomas Koenig
@ 2019-02-16 16:06   ` Janne Blomqvist
  0 siblings, 0 replies; 3+ messages in thread
From: Janne Blomqvist @ 2019-02-16 16:06 UTC (permalink / raw)
  To: Thomas Koenig; +Cc: fortran, gcc-patches

On Sat, Feb 16, 2019 at 3:34 PM Thomas Koenig <tkoenig@netcologne.de> wrote:

> Am 10.02.19 um 12:13 schrieb Thomas Koenig:
> > Hello world,
> >
> > this patch fixes the coarray part of PR 71066 - handling of data
> > statements for coarrays.  The PR itself is marked as a 7/8/9
> > regression.
> >
> > Regression-tested.  OK for trunk and for backporting?
>
> Ping?
>
> Regards
>
>         Thomas
>

Ok.


-- 
Janne Blomqvist

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

end of thread, other threads:[~2019-02-16 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-10 11:13 [patch, fortran] Fix part of PR 71066 Thomas Koenig
2019-02-16 13:34 ` *ping* " Thomas Koenig
2019-02-16 16:06   ` Janne Blomqvist

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).