[Bug fortran/63674] New: procedure pointer and non/pure procedure

valeryweber at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 29 11:59:00 GMT 2014


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

            Bug ID: 63674
           Summary: procedure pointer and non/pure procedure
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: valeryweber at hotmail dot com

Dear All

the following code is compiling fine with 4.9.1, but shouldnt gcc complain
about calling a nonpure procedure from a pure one?

v

cat gcc_pure.f90
module test
  interface
     function func_interface ( ) RESULT( reslt )
       INTEGER :: reslt
     end function func_interface
  end interface
  type :: t
     procedure(func_interface), nopass, pointer :: f => NULL()
  end type t
contains
  function func_1 ( ) RESULT( reslt )
    integer :: reslt
    reslt = 1
  end function func_1
  pure subroutine eval( a, reslt )
    type(t), intent(in) :: a
    integer, intent(out) :: reslt
    reslt = a%f()
    !reslt = func_1()
  end subroutine eval
end module test

program prog
  use test
  type(t) :: a
  integer :: reslt
  a%f=>func_1
  call eval(a,reslt)
  write(*,*) reslt
end program prog

gfortran-4.9.1   gcc_pure.f90
./a.out 
           1



More information about the Gcc-bugs mailing list