This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34199] segfault for TRANSFER integer to TYPE(C_PTR)
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Sep 2008 19:12:37 -0000
- Subject: [Bug fortran/34199] segfault for TRANSFER integer to TYPE(C_PTR)
- References: <bug-34199-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from dominiq at lps dot ens dot fr 2008-09-06 19:12 -------
Extracted from
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/c553e0034bab977c
the following code
module bug1
use ISO_C_BINDING
implicit none
contains
subroutine sub1(x)
type(C_PTR) x
write(*,'(z16.16)') transfer(x,0_C_INTPTR_T)
end subroutine sub1
subroutine sub2(x)
type(C_FUNPTR) x
write(*,'(z16.16)') transfer(x,0_C_INTPTR_T)
end subroutine sub2
subroutine sub3() bind(C)
end subroutine sub3
end module bug1
program test
use bug1
implicit none
integer, target :: i
type(C_FUNPTR) p
p = C_FUNLOC(sub3)
call sub1(C_LOC(i))
call sub2(C_FUNLOC(sub3)) ! Causes ICE
call sub2(p) ! No ICE
end program test
gives with trunk and 4.3.2:
pr34199_4.f90: In function 'test':
pr34199_4.f90:23: internal compiler error: in expand_expr_addr_expr_1, at
expr.c:6848
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34199