[Patch, Fortran] PR40276/PR57711 - improve generic diagnostic

Dominique Dhumieres dominiq@lps.ens.fr
Tue Jul 9 10:13:00 GMT 2013


Dear Tobias,

After this patch several tests related to pr20896 are now rejected,
it is probably right to issue an error for them, but I am not sure
that the message is right, e.g.

! { dg-do compile }
! Test the fix for PR20896 in which the ambiguous use
! of p was not detected.
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
  INTERFACE g
    SUBROUTINE s1(p) ! { dg-error "is already being used" }
      INTERFACE
        SUBROUTINE p
        END
      END INTERFACE
    END
    SUBROUTINE s2(p) ! { dg-error "Global name" }
      INTERFACE
        REAL FUNCTION p()
        END
      END INTERFACE
    END
  END INTERFACE

      INTERFACE
        REAL FUNCTION x()
        END
      END INTERFACE
      INTERFACE
        SUBROUTINE y
        END
      END INTERFACE
  call g (x)
  call g (y)
  END
  REAL FUNCTION x()
    x = 0.1
  END
  SUBROUTINE y()
    print *, 1.5
  END
  SUBROUTINE s1(p)
    call p()
  END
  SUBROUTINE s2(p)
    print *,  p()
  END

is rejected with

pr20896_db.f90:27.20:

        SUBROUTINE y
                    1
Error: FUNCTION attribute conflicts with SUBROUTINE attribute in 'y' at (1)
pr20896_db.f90:31.10:

  call g (y)
          1
Error: Interface mismatch in dummy procedure 'p' at (1): 'y' is not a function

Note that pr20896 is still open, so this should not delay the commit, but will
require to update pr20896.

Thanks for the patch,

Dominique



More information about the Fortran mailing list