diff mbox

[Fortran] Simplify lbound

Message ID 554FD6E1.8090202@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig May 10, 2015, 10:08 p.m. UTC
Am 10.05.2015 um 22:43 schrieb H.J. Lu:

>> Here is what I have committed.
>>
> 
> It caused:
> 
> /export/gnu/import/git/sources/gcc/gcc/testsuite/gfortran.dg/inline_matmul_3.f90:38:39:
> Error: Variable 'c1' cannot appear in the expression at (1)^M

I know that error message, I got it when developing the inline
matmul patches with the same test cases.  I had a fix for this
error message in one of my matmul patches, but it was removed
in the review process because it could no longer be reproduced.

So, here is the fix again.  I think it is close to obvious (since it
fixes the problem and can obviously do no harm), but anyway:  OK for
trunk?

Regards

	Thomas

2015-05-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/66041
	PR fortran/37131
	* gfortran.h (gfc_array_spec):  Add field resolved.
	* array.c (gfc_resolve_array_spec):  Resolve array spec
	only once.
diff mbox

Patch

Index: array.c
===================================================================
--- array.c	(Revision 222984)
+++ array.c	(Arbeitskopie)
@@ -338,6 +338,9 @@  gfc_resolve_array_spec (gfc_array_spec *as, int ch
   if (as == NULL)
     return true;
 
+  if (as->resolved)
+    return true;
+
   for (i = 0; i < as->rank + as->corank; i++)
     {
       e = as->lower[i];
@@ -364,6 +367,8 @@  gfc_resolve_array_spec (gfc_array_spec *as, int ch
 	}
     }
 
+  as->resolved = true;
+
   return true;
 }
 
Index: gfortran.h
===================================================================
--- gfortran.h	(Revision 222984)
+++ gfortran.h	(Arbeitskopie)
@@ -1002,6 +1002,8 @@  typedef struct
   bool cp_was_assumed; /* AS_ASSUMED_SIZE cp arrays are converted to
 			AS_EXPLICIT, but we want to remember that we
 			did this.  */
+
+  bool resolved;
 }
 gfc_array_spec;