diff mbox

[fortran] Fix PR 55314, rejects-valid regression

Message ID 50B0BDE9.1020500@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig Nov. 24, 2012, 12:30 p.m. UTC
Hello world,

the attached patch fixes a 4.6/4.7/4.8 rejects-valid regression.
OK for trunk?

	Thomas

2012-11-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/55314
         * resolve.c (resolve_allocate_deallocate):  Compare all
         subscripts when deciding if to reject a (de)allocate
         statement.

2012-11-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/55314
         * gfortran.dg/allocate_error_4.f90:  New test.

Comments

Janus Weil Nov. 24, 2012, 2:32 p.m. UTC | #1
Hi Thomas,

> the attached patch fixes a 4.6/4.7/4.8 rejects-valid regression.
> OK for trunk?

looks good to me. Thanks for the patch. Ok for trunk and also for the
4.6/4.7 branches ...

Cheers,
Janus




> 2012-11-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
>
>         PR fortran/55314
>         * resolve.c (resolve_allocate_deallocate):  Compare all
>         subscripts when deciding if to reject a (de)allocate
>         statement.
>
> 2012-11-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
>
>         PR fortran/55314
>         * gfortran.dg/allocate_error_4.f90:  New test.
diff mbox

Patch

Index: resolve.c
===================================================================
--- resolve.c	(Revision 192894)
+++ resolve.c	(Arbeitskopie)
@@ -7618,12 +7618,18 @@  resolve_allocate_deallocate (gfc_code *code, const
 
 		      if (pr->next && qr->next)
 			{
+			  int i;
 			  gfc_array_ref *par = &(pr->u.ar);
 			  gfc_array_ref *qar = &(qr->u.ar);
-			  if ((par->start[0] != NULL || qar->start[0] != NULL)
-			      && gfc_dep_compare_expr (par->start[0],
-						       qar->start[0]) != 0)
-			    break;
+
+			  for (i=0; i<par->dimen; i++)
+			    {
+			      if ((par->start[i] != NULL
+				   || qar->start[i] != NULL)
+				  && gfc_dep_compare_expr (par->start[i],
+							   qar->start[i]) != 0)
+				goto break_label;
+			    }
 			}
 		    }
 		  else
@@ -7635,6 +7641,8 @@  resolve_allocate_deallocate (gfc_code *code, const
 		  pr = pr->next;
 		  qr = qr->next;
 		}
+	    break_label:
+	      ;
 	    }
 	}
     }