From 712dff3172d503c496366d148c8e3fe018b584a5 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sat, 30 Jul 2016 18:18:49 +0000 Subject: [PATCH] re PR fortran/70006 (Duplicate errors "label not defined") 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/70006 * gfortran.dg/pr70006.f90: New test. From-SVN: r238905 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/io.c | 2 +- gcc/fortran/resolve.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr70006.f90 | 9 +++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr70006.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 775276bc5c2..3c137ee199f 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 7c648e93cad..08812613aec 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 23da9ac4444..e0a688a76b2 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 d41cfcaa6c3..6ead1195b38 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 00000000000..b8fbb3c26ee --- /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 -- 2.30.2