Skip to content

Commit 824366d

Browse files
committed
single_char: correct type
1 parent f3075af commit 824366d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

test/string/main_char.f90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ program c
66
implicit none
77

88
interface
9-
character(kind=c_char) function three() bind(C)
10-
import
9+
character(kind=C_CHAR, len=1) function three() bind(C)
10+
import C_CHAR
1111
end function
1212
end interface
1313

14-
character :: fc
14+
character(kind=C_CHAR) :: fc
1515

1616
fc = three()
1717

1818
print '(i0,1x,a)', len_trim(fc), fc
1919

20-
if (fc /= "3" .or. len_trim(fc) /= 1) error stop "ERROR: unexpected result from C function"
20+
if (fc /= C_CHAR_"3" .or. len_trim(fc) /= 1) then
21+
write(error_unit, '(a,i0)') "ERROR: unexpected result from C function: " // fc // " length ", len_trim(fc)
22+
error stop
23+
end if
2124

2225
end program

0 commit comments

Comments
 (0)