resolve_ref() calls resolve_substring() but failed to check
its return value.  This patch does the check.

2011-10-15  Steven G. Kargl  <ka...@gcc.gcu.org>

        * resolve.c (resolve_ref): Check return value of resolve_substring().

 
2011-10-15  Steven G. Kargl  <ka...@gcc.gcu.org>

        * gfortran.dg/substring_integer_index.f90: New test.
Index: fortran/resolve.c
===================================================================
--- fortran/resolve.c	(revision 179940)
+++ fortran/resolve.c	(working copy)
@@ -4858,7 +4859,8 @@ resolve_ref (gfc_expr *expr)
 	break;
 
       case REF_SUBSTRING:
-	resolve_substring (ref);
+	if (resolve_substring (ref) == FAILURE)
+	  return FAILURE;
 	break;
       }
 
Index: testsuite/gfortran.dg/substring_integer_index.f90
===================================================================
--- testsuite/gfortran.dg/substring_integer_index.f90	(revision 0)
+++ testsuite/gfortran.dg/substring_integer_index.f90	(revision 0)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/50524
+!
+program foo
+   print *, 'abc'(2.e0:3)   ! { dg-error "must be of type INTEGER"}
+   print *,'qwe'(1:1e0)
+end program foo
+

Reply via email to