Hello,
the following program in F2023 conforming but rejected by ifx 2025.0:
program p
use iso_c_binding
implicit none
character(kind=c_char,len=*), parameter :: s = "abc"
print *, f_c_string (s)
print *, f_c_string (s,.false.)
print *, f_c_string (s,.true.)
print *, .false._1, .true._2,.false._4,.true._8
print *, f_c_string (s,.false._1) ! rejected
print *, f_c_string (s,.true._2) ! rejected
print *, f_c_string (s,.false._4) ! OK
print *, f_c_string (s,.true._8) ! rejected
end
I find:
% ifx ifx_f_c_string.f90
ifx_f_c_string.f90(9): error #6284: There is no matching specific function for this generic function reference. [F_C_STRING]
print *, f_c_string (s,.false._1) ! rejected
-----------^
ifx_f_c_string.f90(10): error #6284: There is no matching specific function for this generic function reference. [F_C_STRING]
print *, f_c_string (s,.true._2) ! rejected
-----------^
ifx_f_c_string.f90(12): error #6284: There is no matching specific function for this generic function reference. [F_C_STRING]
print *, f_c_string (s,.true._8) ! rejected
-----------^
compilation aborted for ifx_f_c_string.f90 (code 1)
F2023:18.2.3.9 has:
ASIS (optional) shall be a logical scalar.
There is no restriction on ASIS being only of default kind.
Furthermore, the handling of ASIS as an optional argument should be such that the following code works:
program p
use iso_c_binding
implicit none
character(kind=c_char,len=*), parameter :: s = "abc"
call sub (.true.)
call sub (.false.)
call sub ()
contains
subroutine sub (asis)
logical, optional, intent(in) :: asis
print *, f_c_string (s, asis)
end
end
I get:
% ifx ifx_f_c_string2.f90 -g -traceback && ./a.out
ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations similar to use of '-O0'
abc
abc
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libpthread-2.31.s 00007F5C7B702910 Unknown Unknown Unknown
a.out 0000000000415342 Unknown Unknown Unknown
a.out 000000000040426A sub 11 ifx_f_c_string2.f90
a.out 00000000004041CE p 7 ifx_f_c_string2.f90
a.out 000000000040417D Unknown Unknown Unknown
libc-2.31.so 00007F5C7B52324D __libc_start_main Unknown Unknown
a.out 00000000004040AA Unknown Unknown Unknown
Thanks,
Harald
連結已複製
3 回應
It is not fixed here:
ifx -what ifx_f_c_string.f90
Intel(R) Fortran 25.0-1485
ifx_f_c_string.f90(9): error #6284: There is no matching specific function for this generic function reference. [F_C_STRING]
print *, f_c_string (s,.false._1) ! rejected
-----------^
ifx_f_c_string.f90(10): error #6284: There is no matching specific function for this generic function reference. [F_C_STRING]
print *, f_c_string (s,.true._2) ! rejected
-----------^
ifx_f_c_string.f90(12): error #6284: There is no matching specific function for this generic function reference. [F_C_STRING]
print *, f_c_string (s,.true._8) ! rejected
-----------^
compilation aborted for ifx_f_c_string.f90 (code 1)
