Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28809 Discussions

Internal compiler error with ichar intrinsic function

whayek
Beginner
270 Views

Hi,

I came across an internal compiler error with ifx v2024.2.1 20240711 when I tried to build a Fortran library that included code similar to this example:

 

program myprog
  ! Compiler detects argument error
  print *, ichar('xy')

  ! Compiler crashes
  print *, ichar(trim('xy'))
end program myprog

 

The "ichar" intrinsic function expects a length=1 character-type variable as input, and the ifx compiler correctly responds with

error #8042: This argument must be of type character and of length 1. ['xy']

in the first case. However, it crashes with this error message in the second case:

#0 0x000000000312d792
#1 0x0000000003191e57
#2 0x000000000317d936
#3 0x000000000309dbe3
#4 0x00000000030a3ac1
#5 0x00000000030b47f8
#6 0x00000000031a10fe
#7 0x0000000003169710
#8 0x00000000031c1176
#9 0x00000000031bcf5f
#10 0x00000000031e0f14
#11 0x00000000031e1495
#12 0x00000000031e3ed0
#13 0x00000000031e0f14
#14 0x00000000031de38a
#15 0x00000000031e0f14
#16 0x00000000030787c6
#17 0x0000000003078175
#18 0x000000000324df17
#19 0x00002aaaabac0590
#20 0x00002aaaabac0640 __libc_start_main + 128
#21 0x0000000002eb06ea

myprog.F90(7): error #5623: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
print *, ichar(trim('xy'))
-----------------^
compilation aborted for myprog.F90 (code 1)

The Intel Fortran Compiler Classic compiles the second case, and it will provide the "ichar" value of the first character of the string returned by the "trim" intrinsic function. Same for gfortran, but only if the argument of "trim" is a variable, otherwise its static code analyser will not accept case 2 either.

Labels (1)
0 Kudos
1 Solution
Ron_Green
Moderator
216 Views

Thanks for sending this to us. The bug ID is CMPLRLLVM-62576


View solution in original post

0 Kudos
1 Reply
Ron_Green
Moderator
217 Views

Thanks for sending this to us. The bug ID is CMPLRLLVM-62576


0 Kudos
Reply