2 ! { dg-options "-fdump-tree-original" }
5 ! Bind(C) procedures shall have no character length
6 ! dummy and actual arguments.
11 subroutine sub1noiso(a, b)
14 character(len=1,kind=c_char) :: a(*), b
15 character(len=1,kind=c_char):: x,z
19 end subroutine sub1noiso
21 subroutine sub2(a, b) bind(c)
24 character(len=1,kind=c_char) :: a(*), b
25 character(len=1,kind=c_char):: x,z
31 ! SUBROUTINES with ENTRY
33 subroutine sub3noiso(a, b)
36 character(len=1,kind=c_char) :: a(*), b
37 character(len=1,kind=c_char):: x,z
41 entry sub3noisoEntry(x,y,z)
43 end subroutine sub3noiso
45 subroutine sub4iso(a, b) bind(c)
48 character(len=1,kind=c_char) :: a(*), b
49 character(len=1,kind=c_char):: x,z
53 entry sub4isoEntry(x,y,z)
55 end subroutine sub4iso
57 subroutine sub5iso(a, b) bind(c)
60 character(len=1,kind=c_char) :: a(*), b
61 character(len=1,kind=c_char):: x,z
65 entry sub5noIsoEntry(x,y,z)
67 end subroutine sub5iso
69 subroutine sub6NoIso(a, b)
72 character(len=1,kind=c_char) :: a(*), b
73 character(len=1,kind=c_char):: x,z
77 entry sub6isoEntry(x,y,z)
79 end subroutine sub6NoIso
81 ! The subroutines (including entry) should have
82 ! only a char-length parameter if they are not bind(C).
84 ! { dg-final { scan-tree-dump "sub1noiso \\(\[^.\]*a, \[^.\]*b, \[^.\]*_a, \[^.\]*_b\\)" "original" } }
85 ! { dg-final { scan-tree-dump "sub2 \\(\[^.\]*a, \[^.\]*b\\)" "original" } }
86 ! { dg-final { scan-tree-dump "sub3noiso \\(\[^.\]*a, \[^.\]*b, \[^.\]*_a, \[^.\]*_b\\)" "original" } }
87 ! { dg-final { scan-tree-dump "sub3noisoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } }
88 ! { dg-final { scan-tree-dump "sub4iso \\(\[^.\]*a, \[^.\]*b\\)" "original" } }
89 ! { dg-final { scan-tree-dump "sub4isoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } }
90 ! { dg-final { scan-tree-dump "sub5iso \\(\[^.\]*a, \[^.\]*b\\)" "original" } }
91 ! { dg-final { scan-tree-dump "sub5noisoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } }
92 ! { dg-final { scan-tree-dump "sub6noiso \\(\[^.\]*a, \[^.\]*b, \[^.\]*_a, \[^.\]*_b\\)" "original" } }
93 ! { dg-final { scan-tree-dump "sub6isoentry \\(\[^.\]*x, \[^.\]*y, \[^.\]*z, \[^.\]*_x, \[^.\]*_z\\)" "original" } }
95 ! The master functions should have always a length parameter
96 ! to ensure sharing a parameter between bind(C) and non-bind(C) works
98 ! { dg-final { scan-tree-dump "master.0.sub3noiso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } }
99 ! { dg-final { scan-tree-dump "master.1.sub4iso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } }
100 ! { dg-final { scan-tree-dump "master.2.sub5iso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } }
101 ! { dg-final { scan-tree-dump "master.3.sub6noiso \\(\[^.\]*__entry, \[^.\]*z, \[^.\]*y, \[^.\]*x, \[^.\]*b, \[^.\]*a, \[^.\]*_z, \[^.\]*_x, \[^.\]*_b, \[^.\]*_a\\)" "original" } }
103 ! Thus, the master functions need to be called with length arguments
106 ! { dg-final { scan-tree-dump "master.0.sub3noiso .0, 0B, 0B, 0B, b, a, 0, 0, 1, 1\\);" "original" } }
107 ! { dg-final { scan-tree-dump "master.0.sub3noiso .1, z, y, x, 0B, 0B, 1, 1, 0, 0\\);" "original" } }
108 ! { dg-final { scan-tree-dump "master.1.sub4iso .0, 0B, 0B, 0B, b, a, 0, 0, 1, 1\\);" "original" } }
109 ! { dg-final { scan-tree-dump "master.1.sub4iso .1, z, y, x, 0B, 0B, 1, 1, 0, 0\\);" "original" } }
110 ! { dg-final { scan-tree-dump "master.2.sub5iso .0, 0B, 0B, 0B, b, a, 0, 0, 1, 1\\);" "original" } }
111 ! { dg-final { scan-tree-dump "master.2.sub5iso .1, z, y, x, 0B, 0B, 1, 1, 0, 0\\);" "original" } }
112 ! { dg-final { scan-tree-dump "master.3.sub6noiso .0, 0B, 0B, 0B, b, a, 0, 0, 1, 1\\);" "original" } }
113 ! { dg-final { scan-tree-dump "master.3.sub6noiso .1, z, y, x, 0B, 0B, 1, 1, 0, 0\\);" "original" } }
115 ! { dg-final { cleanup-tree-dump "original" } }