diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 775276bc5c29..3c137ee199f6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-07-30 Steven G. Kargl + + PR fortran/70006 + * io.c (gfc_resolve_dt): Use correct locus. + * resolve.c (resolve_branch): Ditto. + 2016-07-30 Steven G. Kargl PR fortran/71730 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 7c648e93cad6..08812613aecf 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -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; } diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 23da9ac44444..e0a688a76b26 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -8966,7 +8966,7 @@ resolve_branch (gfc_st_label *label, gfc_code *code) if (label->defined == ST_LABEL_UNKNOWN) { gfc_error ("Label %d referenced at %L is never defined", label->value, - &label->where); + &code->loc); return; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d41cfcaa6c31..6ead1195b38f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-30 Steven G. Kargl + + PR fortran/70006 + * gfortran.dg/pr70006.f90: New test. + 2016-07-30 Steven G. Kargl PR fortran/71730 diff --git a/gcc/testsuite/gfortran.dg/pr70006.f90 b/gcc/testsuite/gfortran.dg/pr70006.f90 new file mode 100644 index 000000000000..b8fbb3c26ee1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr70006.f90 @@ -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