1! { dg-do run { target c99_runtime } } 2! { dg-additional-sources ISO_Fortran_binding_13.c } 3! 4! Test the fix for PR91926. The additional source is the main program. 5! 6! Contributed by José Rui Faustino de Sousa <jrfsousa@hotmail.com> 7! 8program ifb_p 9 10 implicit none 11 12 integer :: i = 42 13 14 interface 15 integer function ifb_echo_aux(this) bind(c, name="ifb_echo") 16 implicit none 17 type(*), dimension(..), & ! removing assumed rank solves segmentation fault 18 optional, intent(in) :: this 19 end function ifb_echo_aux 20 end interface 21 22 if (ifb_echo_aux() .ne. 1) STOP 1 ! worked 23 if (ifb_echo() .ne. 1) stop 2 ! segmentation fault 24 if (ifb_echo_aux(i) .ne. 2) stop 3 ! worked 25 if (ifb_echo(i) .ne. 2) stop 4 ! worked 26 27 stop 28 29contains 30 31 integer function ifb_echo(this) 32 type(*), dimension(..), & 33 optional, intent(in) :: this 34 35 ifb_echo = ifb_echo_aux(this) 36 return 37 end function ifb_echo 38 39end program ifb_p 40