PR 71156: interface inconsistency between module interface vs. submodule definition

Damian Rouson damian@rouson.net
Tue May 17 00:46:00 GMT 2016


All,

As shown below, gfortran 6.1.0 rejects the application of the PURE 
attribute consistently in a procedure interface body and in the 
corresponding procedure definition.  Conversely, gfortran accepts the
inconsistent approach (not shown) of using PURE in the interface body 
but omitting PURE from the procedure definition.  By contrast, the Cray 
and Intel compilers behave opposite to gfortran: Intel and Cray accept the 
consistent syntax below and reject the inconsistent syntax in which PURE 
appears only in the interface body or only in the definition.  If Intel and 
Cray are correct, then gfortran is accepting invalid code and rejecting the 
complementary valid code.  It would be great if a fix could be applied 
to the 6 and 7 branches.

Damian

$ cat consistency.f90 
module my_interface
  implicit none
  interface
    pure module subroutine f
    end subroutine
  end interface
end module 

submodule(my_interface) my_implementation
  implicit none
contains
    pure module subroutine f
    end subroutine
end submodule

$ gfortran -c consistency.f90 
consistency.f90:12:28:

     pure module subroutine f
                            1
Error: Duplicate PURE attribute specified at (1)

$ gfortran --version
GNU Fortran (MacPorts gcc6 6.1.0_0) 6.1.0



More information about the Fortran mailing list