annotate gcc/testsuite/gfortran.dg/c_funloc_tests_6.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do compile }
kono
parents:
diff changeset
2 ! { dg-options "-std=f2008" }
kono
parents:
diff changeset
3 !
kono
parents:
diff changeset
4 ! Check relaxed TS29113 constraints for procedures
kono
parents:
diff changeset
5 ! and c_f_*pointer argument checking for c_ptr/c_funptr.
kono
parents:
diff changeset
6 !
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 use iso_c_binding
kono
parents:
diff changeset
9 implicit none
kono
parents:
diff changeset
10 type(c_ptr) :: cp
kono
parents:
diff changeset
11 type(c_funptr) :: cfp
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 interface
kono
parents:
diff changeset
14 subroutine sub() bind(C)
kono
parents:
diff changeset
15 end subroutine sub
kono
parents:
diff changeset
16 end interface
kono
parents:
diff changeset
17 integer(c_int), pointer :: int
kono
parents:
diff changeset
18 procedure(sub), pointer :: fsub
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 integer, external :: noCsub
kono
parents:
diff changeset
21 procedure(integer), pointer :: fint
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 cp = c_funloc (sub) ! { dg-error "Can't convert TYPE.c_funptr. to TYPE.c_ptr." })
kono
parents:
diff changeset
24 cfp = c_loc (int) ! { dg-error "Can't convert TYPE.c_ptr. to TYPE.c_funptr." }
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 call c_f_pointer (cfp, int) ! { dg-error "Argument CPTR at .1. to C_F_POINTER shall have the type TYPE.C_PTR." }
kono
parents:
diff changeset
27 call c_f_procpointer (cp, fsub) ! { dg-error "Argument CPTR at .1. to C_F_PROCPOINTER shall have the type TYPE.C_FUNPTR." }
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 cfp = c_funloc (noCsub) ! { dg-error "TS 29113/TS 18508: Noninteroperable procedure at .1. to C_FUNLOC" }
kono
parents:
diff changeset
30 call c_f_procpointer (cfp, fint) ! { dg-error "TS 29113/TS 18508: Noninteroperable procedure pointer at .1. to C_F_PROCPOINTER" }
kono
parents:
diff changeset
31 end