This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70006

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]