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

            Bug ID: 71156
           Summary: PURE interface/definition inconsistency: accepts
                    invalid, rejects valid
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

As shown below, gfortran 6.1.0 rejects the application of the PURE attribute
consistently in a procedure interface body and 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 and it would be great if a fix could be
applied to the 6 and 7 branches.

$ 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

Reply via email to