The following invalid program (based on gfortran.dg/result_in_spec_1.f90 used
to find PR32046) causes an ICE.
NAG f95 duly reports:
Error: result_in_spec_1.f90, line 4: Too few arguments in reference to F
result_in_spec_1.f90: In function 'MAIN__':
result_in_spec_1.f90:21: internal compiler error: Segmentation fault
==10984== Invalid read of size 8
==10984== at 0x483928: gfc_apply_interface_mapping_to_expr
(trans-expr.c:1656)
==10984== by 0x489D4E: gfc_apply_interface_mapping (trans-expr.c:1696)
==10984== by 0x485302: gfc_conv_function_call (trans-expr.c:2301)
module test1
implicit none
contains
character(f()) function test2(x) result(r)
implicit integer (x)
dimension r(len(r)+1)
integer, intent(in) :: x
interface
pure function f(x)
integer, intent(in) :: x
integer f
end function f
end interface
end function test2
pure function f()
integer f
f = 2
end function f
end module test1
program test
use test1
implicit none
integer :: i
i = len(test2(10))
end program test
--
Summary: ICE (segfault) for pure function without argument
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32047