diff mbox

fortran/50524 -- Check return status of resolving substring ref

Message ID 20111015223944.GA39231@troutmask.apl.washington.edu
State New
Headers show

Commit Message

Steve Kargl Oct. 15, 2011, 10:39 p.m. UTC
resolve_ref() calls resolve_substring() but failed to check
its return value.  This patch does the check.

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

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

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

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

Comments

Janus Weil Oct. 16, 2011, 8:34 a.m. UTC | #1
Hi Steve,

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

Looks pretty obvious. Please commit.

Thanks for the patch,
Janus



> 2011-10-15  Steven G. Kargl  <kargl@gcc.gcu.org>
>
>        * resolve.c (resolve_ref): Check return value of resolve_substring().
>
>
> 2011-10-15  Steven G. Kargl  <kargl@gcc.gcu.org>
>
>        * gfortran.dg/substring_integer_index.f90: New test.
>
diff mbox

Patch

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
+