This works fine with ifort, but gets an ICE with ifx (IFX) 2023.1.0 20230320
program demo_s2c
implicit none
character(len=*),parameter :: string='single string'
character(len=3),allocatable :: array(:)
integer :: i
! put one character into each 3-character element of array
array = [(string(i:i),i=1,len(string))]
! write array with ASCII Decimal Equivalent below it except show
! unprintable characters like NULL as "XXX"
write(*,'(1x,*("[",a3,"]":))') merge('XXX',array,iachar(array(:)(1:1)) < 32)
write(*,'(1x,*("[",i3,"]":))') iachar(array(:)(1:1))
end program demo_s2c
Thanks for reporting this! I have good news! I compiled with an internal build of the next compiler and no ICE. This compiler is planned for release mid-year 2023.
This output matches what I get from ifort.
$ ifx demo_s2c.f90
$ a.out
[s ][i ][n ][g ][l ][e ][ ][s ][t ][r ][i ][n ][g ]
[115][105][110][103][108][101][ 32][115][116][114][105][110][103]
链接已复制
Thanks for reporting this! I have good news! I compiled with an internal build of the next compiler and no ICE. This compiler is planned for release mid-year 2023.
This output matches what I get from ifort.
$ ifx demo_s2c.f90
$ a.out
[s ][i ][n ][g ][l ][e ][ ][s ][t ][r ][i ][n ][g ]
[115][105][110][103][108][101][ 32][115][116][114][105][110][103]
I just confirmed the ICE you reported is actually fixed in the compiler that will be available in the next few weeks as part of oneAPI 2023.2.
Be sure to check it out when it is available.