PR fortran/70006 -- Patch
Steve Kargl
sgk@troutmask.apl.washington.edu
Thu Jul 28 23:44:00 GMT 2016
I intend to commit this patch in the next day or two
unless someone objects.
2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/70006
* io.c (gfc_resolve_dt): Use correct locus.
* resolve.c (resolve_branch): Ditto.
2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/70006
* gfortran.dg/pr70006.f90: New test.
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c (revision 238842)
+++ gcc/fortran/io.c (working copy)
@@ -3052,7 +3052,7 @@ gfc_resolve_dt (gfc_dt *dt, locus *loc)
&& dt->format_label->defined == ST_LABEL_UNKNOWN)
{
gfc_error ("FORMAT label %d at %L not defined", dt->format_label->value,
- &dt->format_label->where);
+ loc);
return false;
}
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 238842)
+++ gcc/fortran/resolve.c (working copy)
@@ -8966,7 +8966,7 @@ resolve_branch (gfc_st_label *label, gfc
if (label->defined == ST_LABEL_UNKNOWN)
{
gfc_error ("Label %d referenced at %L is never defined", label->value,
- &label->where);
+ &code->loc);
return;
}
Index: gcc/testsuite/gfortran.dg/pr70006.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr70006.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr70006.f90 (working copy)
@@ -0,0 +1,9 @@
+! { dg-do compile}
+program test
+ print 1, 'string 1' ! { dg-error "FORMAT label 1" " " { target *-*-* } 3 }
+ print 1, 'string 2' ! { dg-error "FORMAT label 1" " " { target *-*-* } 4 }
+!1 format(a)
+ goto 2 ! { dg-error "Label 2 referenced" " " { target *-*-* } 6 }
+ goto 2 ! { dg-error "Label 2 referenced" " " { target *-*-* } 7 }
+!2 continue
+end program
--
Steve
More information about the Fortran
mailing list