Re: Syntax check for IMPLICIT statement



"James Van Buskirk" <not_valid@xxxxxxxxxxx> wrote in message
news:2rOdnebmkc-n3IjVnZ2dnUVZ_qiinZ2d@xxxxxxxxxxxxxx

I still haven't been able to distill the above-mentioned ICE, but
here's a pretty small one:

I still haven't gotten to that one, but here is one that was hard
to isolate:

C:\gfortran\clf\startest>type bug2.f90
module mod1
use ISO_C_BINDING, only: p => C_PTR
use ISO_C_BINDING, only: C_INTPTR_T
implicit none
private
public sub
interface sub
module procedure sub1
end interface sub
contains
subroutine sub1(x)
type(p) x

write(*,'(a,z16.16)') 'In sub1, x = ', transfer(x,0_C_INTPTR_T)
end subroutine sub1
end module mod1

module mod2
use ISO_C_BINDING, only: p => C_FUNPTR
use ISO_C_BINDING, only: C_INTPTR_T
implicit none
private
public sub
interface sub
module procedure sub1
end interface sub
contains
subroutine sub1(x)
type(p) x

write(*,'(a,z16.16)') 'In sub1, x = ', transfer(x,0_C_INTPTR_T)
end subroutine sub1
end module mod2

module bug2
use ISO_C_BINDING
use mod1
use mod2
implicit none
interface sub
module procedure sub2
end interface sub
contains
subroutine sub2(x)
character(*) x

write(*,'(a,a)') 'In sub2, x = ', x
end subroutine sub2
subroutine sub4() bind(C)
end subroutine sub4
end module bug2

program test
use bug2
implicit none
integer, target :: i
type(C_FUNPTR) fp

call sub(C_LOC(i))
call sub('Hello')
fp = C_FUNLOC(sub4)
call sub(fp)
end program test

C:\gfortran\clf\startest>gfortran bug2.f90 -obug2
bug2.f90:37.11:

use mod1
1
Warning: Although not referenced, 'sub' at (1) has ambiguous interfaces
bug2.f90:54.11:

use bug2
1
Error: Ambiguous interfaces 'sub1' and 'sub1' in generic interface 'sub' at
(1)

It seems to require that the particular sub1 that takes a type(C_PTR)
dummy and the one that takes a type(C_FUNPTR) dummy are used to
make instances of the same generic subroutine in their own modules,
and then the two generics are conbined in the another module.
The problem doesn't show if all subroutines are defined in the
same module and used there to make the generic in one step. Also
other types don't collide destructively like these two do.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


.



Relevant Pages

  • Terminator 2.0 Fortran Source Code
    ... SUBROUTINE TailHookm ... implicit real*8 ... common/constm2/xm, gmmars, radM,rm,soiM,omm,phM,rpM ...
    (comp.lang.fortran)
  • Re: memory leak help!
    ... a loop from the main program. ... REPLACE THE NEW COMPLEX INTO ORIGINAL ARRAY x ... END OF SUBROUTINE SCEUA ... IMPLICIT NONE ...
    (comp.lang.fortran)
  • Re: Pointers to procedures in Intel Fortran
    ... implicit none ... subroutine fooint ... end interface genfoo ...
    (comp.lang.fortran)
  • Re: Fortran templates
    ... implicit none ... end subroutine _READFILE_DATA_NAME ... myvalue % classname = classname ... subroutine printdata (myvalue) ...
    (comp.lang.fortran)
  • Re: Fortran templates
    ... end subroutine READFILE_DATA_NAME ... implicit logical ... myvalue % classname = classname ... subroutine printdata (myvalue) ...
    (comp.lang.fortran)