Patchwork [Fortran] Fix PR 53824

login
register
mail settings
Submitter Thomas Koenig
Date July 15, 2012, 11:26 a.m.
Message ID <5002A8DA.60704@netcologne.de>
Download mbox | patch
Permalink /patch/171058/
State New
Headers show

Comments

Thomas Koenig - July 15, 2012, 11:26 a.m.
Hello world,

this fixes an ICE with allocation of coarrays.  Regression-tested.

OK for trunk?  What about 4.7?

	Thomas

2012-07-15  Thomas König  <tkoenig@gcc.gnu.org>

         PR fortran/53824
         * resolve.c (resolve_allocate_deallocate):  If both
         start indices are NULL, skip the test for equality.

2012-07-15  Thomas König  <tkoenig@gcc.gnu.org>

         PR fortran/53824
         * gfortran.dg/coarray_allocate_1.f90:  New test.
Tobias Burnus - July 15, 2012, 7:43 p.m.
Thomas Koenig wrote:
> this fixes an ICE with allocation of coarrays.  Regression-tested.
> OK for trunk?  What about 4.7?

OK. Thanks for the patch. Regarding 4.7, I don't have a strong opinion. 
Given that it is a simple patch and given that (single-image) coarrays 
work rather well in 4.7, maybe one should.

Tobias

> 2012-07-15 Thomas König  <tkoenig@gcc.gnu.org>
>
>         PR fortran/53824
>         * resolve.c (resolve_allocate_deallocate):  If both
>         start indices are NULL, skip the test for equality.
>
> 2012-07-15  Thomas König  <tkoenig@gcc.gnu.org>
>
>         PR fortran/53824
>         * gfortran.dg/coarray_allocate_1.f90:  New test.

Patch

Index: resolve.c
===================================================================
--- resolve.c	(Revision 189478)
+++ resolve.c	(Arbeitskopie)
@@ -7326,8 +7326,8 @@  resolve_allocate_deallocate (gfc_code *code, const
 	  }
     }
 
-  /* Check that an allocate-object appears only once in the statement.  
-     FIXME: Checking derived types is disabled.  */
+  /* Check that an allocate-object appears only once in the statement.  */
+
   for (p = code->ext.alloc.list; p; p = p->next)
     {
       pe = p->expr;
@@ -7377,9 +7377,10 @@  resolve_allocate_deallocate (gfc_code *code, const
 			{
 			  gfc_array_ref *par = &(pr->u.ar);
 			  gfc_array_ref *qar = &(qr->u.ar);
-			  if (gfc_dep_compare_expr (par->start[0],
-						    qar->start[0]) != 0)
-			      break;
+			  if ((par->start[0] != NULL || qar->start[0] != NULL)
+			      && gfc_dep_compare_expr (par->start[0],
+						       qar->start[0]) != 0)
+			    break;
 			}
 		    }
 		  else