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

            Bug ID: 70006
           Summary: Duplicate errors "label not defined"
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chilikin.k at gmail dot com
  Target Milestone: ---

Created attachment 37815
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37815&action=edit
Test program

Compilation of the following program (attached)

$ cat test.f
      PROGRAM TEST
      PRINT 1, 'STRING 1'
      PRINT 1, 'STRING 2'
!    1 FORMAT(A)
      GOTO 2 ! LINE 5
      GOTO 2 ! LINE 6
!    2 CONTINUE
      END PROGRAM

results in duplicate error messages instead of two different errors for each of
two labels:

$ gfortran -o test test.f
test.f:3:13:

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

       PRINT 1, 'STRING 2'
             1
Error: FORMAT label 1 at (1) not defined
test.f:6:72: Error: Label 2 referenced at (1) is never defined
test.f:6:72: Error: Label 2 referenced at (1) is never defined

Compiler version:

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/gcc-5.3/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.3.0/configure --prefix=/opt/gcc-5.3
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 5.3.0 (GCC) 

Error messages with gcc 4.9.2:

$ /usr/bin/gfortran -o test test.f
test.f:3.13:

      PRINT 1, 'STRING 2'                                               
             1
Error: FORMAT label 1 at (1) not defined
test.f:3.13:

      PRINT 1, 'STRING 2'                                               
             1
Error: FORMAT label 1 at (1) not defined
test.f:6.72:

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

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

Reply via email to