[Bug fortran/70006] Duplicate errors "label not defined"

2016-09-30 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #10 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Sep 30 15:50:31 2016
New Revision: 240659

URL: https://gcc.gnu.org/viewcvs?rev=240659=gcc=rev
Log:
2016-09-30  Steven G. Kargl  

Backport from trunk

PR fortran/70006
* io.c (gfc_resolve_dt): Use correct locus.
* resolve.c (resolve_branch): Ditto.

2016-09-30  Steven G. Kargl  

Backport from trunk

PR fortran/70006
* gfortran.dg/pr70006.f90: New test.

Added:
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr70006.f90
Modified:
branches/gcc-5-branch/gcc/fortran/ChangeLog
branches/gcc-5-branch/gcc/fortran/io.c
branches/gcc-5-branch/gcc/fortran/resolve.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug fortran/70006] Duplicate errors "label not defined"

2016-07-30 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |kargl at gcc dot gnu.org
   Target Milestone|--- |7.0

--- Comment #9 from kargl at gcc dot gnu.org ---
fixed on trunk

[Bug fortran/70006] Duplicate errors "label not defined"

2016-07-30 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #8 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Jul 30 18:18:49 2016
New Revision: 238905

URL: https://gcc.gnu.org/viewcvs?rev=238905=gcc=rev
Log:
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.

Added:
trunk/gcc/testsuite/gfortran.dg/pr70006.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/io.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/70006] Duplicate errors "label not defined"

2016-07-02 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #7 from kargl at gcc dot gnu.org ---
Index: io.c
===
--- io.c(revision 237945)
+++ 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,
->format_label->where);
+loc);
   return false;
 }

Index: resolve.c
===
--- resolve.c   (revision 237945)
+++ resolve.c   (working copy)
@@ -8943,7 +8949,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,
->where);
+>loc);
   return;
 }

[Bug fortran/70006] Duplicate errors "label not defined"

2016-02-29 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #5)
> > OK, How about WONTFIX?  If the programmer fixes the
> > issue reported in the "duplicate" error message, then
> > the problem goes away.
> 
> Well, this is quite general: if your code does not generate any error you'll
> never the the shortcomings of the error handling! Nevertheless the laters
> have to be fixed from a QOI point of view.

It's not general at all.  If the programmer fixes the
error reported in the first message, then the second
error message will not occur.  Fairly simple concept.

(It's clear that when I added -fmax-errors to gfortran,
I should have made the default 1 instead of 25.)

> > Amazing what an error message can convey!
> >
> > PS:  The first duplicate error can be fixed by a
> > trivial 3 character patch.  The second duplicate
> > error will probably take a significant rewrite of
> > how labels are handle.  Good luck.
> 
> AFAIU the gfortran error handling, "duplicate" here does not mean that the
> errors are repeated more than once as in pr44978, but rather that the first
> errors are "shadowed" by the last ones. Compiling the following modified test

gfortran is reporting the correct number of error messages as
there are four errors in the original code.  I've actually
read the code (and fixed the first issue in my local code
repository).  The first set of duplicate error messages can
be fixed with these three characters: loc.  The second set
of duplicated error messages requires someone to rewrite
how labels are handled.  Given that a sensible error message
is emitted, it's not worth the effort.

[Bug fortran/70006] Duplicate errors "label not defined"

2016-02-28 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #5 from Dominique d'Humieres  ---
> OK, How about WONTFIX?  If the programmer fixes the
> issue reported in the "duplicate" error message, then
> the problem goes away.

Well, this is quite general: if your code does not generate any error you'll
never the the shortcomings of the error handling! Nevertheless the laters have
to be fixed from a QOI point of view.

> Amazing what an error message can convey!
>
> PS:  The first duplicate error can be fixed by a
> trivial 3 character patch.  The second duplicate
> error will probably take a significant rewrite of
> how labels are handle.  Good luck.

AFAIU the gfortran error handling, "duplicate" here does not mean that the
errors are repeated more than once as in pr44978, but rather that the first
errors are "shadowed" by the last ones. Compiling the following modified test

  PROGRAM TEST
  PRINT 1, 'STRING 1'
!1 FORMAT(A)
  GOTO 2 ! LINE 4
  PRINT 1, 'STRING 2'
  GOTO 2 ! LINE 6
!2 CONTINUE
  END PROGRAM

gives

pr70006_db_1.f90:5:13:

   PRINT 1, 'STRING 2'
 1
Error: FORMAT label 1 at (1) not defined
pr70006_db_1.f90:6:21:

   GOTO 2 ! LINE 6
 1
Error: Label 2 referenced at (1) is never defined
pr70006_db_1.f90:5:13:

   PRINT 1, 'STRING 2'
 1
Error: FORMAT label 1 at (1) not defined
pr70006_db_1.f90:6:21:

   GOTO 2 ! LINE 6
 1
Error: Label 2 referenced at (1) is never defined

while the first two errors should be

pr70006_db_1.f90:2:13:

   PRINT 1, 'STRING 1'
 1
Error: FORMAT label 1 at (1) not defined
pr70006_db_1.f90:4:21:

   GOTO 2 ! LINE 4
 1
Error: Label 2 referenced at (1) is never defined

[Bug fortran/70006] Duplicate errors "label not defined"

2016-02-28 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #4 from kargl at gcc dot gnu.org ---
OK, How about WONTFIX?  If the programmer fixes the
issue reported in the "duplicate" error message, then
the problem goes away.  Amazing what an error message
can convey!

PS:  The first duplicate error can be fixed by a
trivial 3 character patch.  The second duplicate
error will probably take a significant rewrite of
how labels are handle.  Good luck.

[Bug fortran/70006] Duplicate errors "label not defined"

2016-02-28 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|RESOLVED|NEW
 Resolution|WORKSFORME  |---

--- Comment #3 from Dominique d'Humieres  ---
Steve, look again!

[Bug fortran/70006] Duplicate errors "label not defined"

2016-02-28 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||kargl at gcc dot gnu.org
 Resolution|--- |WORKSFORME

--- Comment #2 from kargl at gcc dot gnu.org ---
% gfc -c a.f
a.f:3:13:

   PRINT 1, 'STRING 2'
 1
Error: FORMAT label 1 at (1) not defined
a.f:3:13:

   PRINT 1, 'STRING 2'
 1
Error: FORMAT label 1 at (1) not defined
a.f:6:72:

   GOTO 2 ! LINE 6
1
Error: Label 2 referenced at (1) is never defined
a.f:6:72:

   GOTO 2 ! LINE 6
1
Error: Label 2 referenced at (1) is never defined

% gfc -v
gcc version 6.0.0 20160206 (experimental) (GCC)

[Bug fortran/70006] Duplicate errors "label not defined"

2016-02-28 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-02-28
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed from 4.3.1 up to trunk (6.0).