File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Examples/test-suite/fortran Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -110,18 +110,22 @@ subroutine test_strings
110
110
use fortran_bindc
111
111
use ISO_C_BINDING
112
112
implicit none
113
+ character (kind= c_char, len=* ), parameter :: mystring = " I'm a string!"
114
+ #if __GNUC__ >= 9
113
115
type (C_PTR) :: cptr
114
116
character (kind= c_char, len= :), pointer :: cstrptr
115
- character (kind = c_char, len =* ), parameter :: mystring = " I'm a string! "
117
+ # endif
116
118
117
119
ASSERT(strlen(mystring // C_NULL_CHAR) == len (mystring))
118
120
119
- ! Note: not sure if the C-to-Fortran here is truly defined behavior
121
+ #if __GNUC__ >= 9
122
+ ! Note: this seems to be allowed in GCC 9 but not before. I'm not sure that it's the correct behavior.
120
123
cptr = getstr(1 )
121
124
call c_f_pointer(cptr, cstrptr)
122
125
ASSERT(associated (cstrptr))
123
126
ASSERT(strlen(cstrptr) == 3 )
124
127
ASSERT(cstrptr(1 :3 ) == " one" )
128
+ #endif
125
129
126
130
end subroutine
127
131
You can’t perform that action at this time.
0 commit comments