Re: Syntax check for IMPLICIT statement
- From: "James Van Buskirk" <not_valid@xxxxxxxxxxx>
- Date: Sun, 27 Apr 2008 23:11:09 -0600
"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
.
- Follow-Ups:
- Re: Syntax check for IMPLICIT statement
- From: James Van Buskirk
- Re: Syntax check for IMPLICIT statement
- References:
- Syntax check for IMPLICIT statement
- From: James Van Buskirk
- Re: Syntax check for IMPLICIT statement
- From: James Van Buskirk
- Syntax check for IMPLICIT statement
- Prev by Date: Re: gfortran produces huge executables
- Next by Date: Re: gfortran produces huge executables
- Previous by thread: Re: Syntax check for IMPLICIT statement
- Next by thread: Re: Syntax check for IMPLICIT statement
- Index(es):
Relevant Pages
|
|