Message ID | 20111015223944.GA39231@troutmask.apl.washington.edu |
---|---|
State | New |
Headers | show |
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. >
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 +