[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    PR 71156: interface inconsistency between module interface vs. submodule definition
From:       Damian Rouson <damian () rouson ! net>
Date:       2016-05-17 0:46:41
Message-ID: A4F7641F-D10D-42E2-AE80-7A2A862CD56B () stanford ! edu
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic