Re: Syntax check for IMPLICIT statement



"James Van Buskirk" <not_valid@xxxxxxxxxxx> wrote in message
news:wpmdnYLdJ7wLl4jVnZ2dnUVZ_jednZ2d@xxxxxxxxxxxxxx

As you can see, this program is capable of reproducing the ifort
error but I haven't been able to make a small program that
reproduces the gfortran ICE.

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

C:\gfortran\clf\startest>type bug1.f90
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
end module bug1

program test
use bug1
implicit none
call sub1(transfer(7_C_INTPTR_T,C_NULL_PTR))
call sub2(transfer(7_C_INTPTR_T,C_NULL_FUNPTR))
end program test

C:\gfortran\clf\startest>gfortran bug1.f90 -obug1
bug1.f90:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

What seems to be getting gfortran down is the TRANSFERs in
the actual arguments. Switching to C_LOC for the invocation
of sub1 fixes that call up, but for sub2 you have to go all
the way to a temporary variable to prevent ICE:

C:\gfortran\clf\startest>type bug1a.f90
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

C:\gfortran\clf\startest>gfortran bug1a.f90 -obug1a
bug1a.f90: In function 'test':
bug1a.f90:25: internal compiler error: in expand_expr_addr_expr_1, at
expr.c:680
3
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

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


.



Relevant Pages