- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the following code causes an internal compiler error with:
$ ifort -diag-disable=10448 -V
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.11.1 Build 20231117_000000
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
$ ifort -diag-disable=10448 -c mod_test.f90
010101_13941
catastrophic error: **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.
compilation aborted for mod_test.f90 (code 1)
and also with:
$ ifx -V
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
$ ifx -c mod_test.f90
#0 0x000000000232d4ea
#1 0x0000000002394d07
#2 0x0000000002394cd6
#3 0x00000000022a95a9
#4 0x000000000243b132
#5 0x00000000024371ab
#6 0x000000000239daf8
#7 0x000000000236c7ed
#8 0x000000000236bc2b
#9 0x000000000236d4ac
#10 0x00000000023e2ba4
#11 0x00000000023e3215
#12 0x00000000023e37f5
#13 0x00000000023e0981
#14 0x00000000023e3215
#15 0x00000000023e37f5
#16 0x00000000023695d9
#17 0x00000000023692ab
#18 0x000000000236b02f
#19 0x00000000023e3215
#20 0x00000000023e37f5
#21 0x00000000023695d9
#22 0x00000000023692ab
#23 0x000000000236b02f
#24 0x00000000023e3215
#25 0x00000000023e37f5
#26 0x00000000023e5f6d
#27 0x00000000023e3215
#28 0x00000000023e37f5
#29 0x00000000023e0f02
#30 0x00000000023e3215
#31 0x00000000023e05ba
#32 0x00000000023e3215
#33 0x00000000022703e6
#34 0x000000000226fd9e
#35 0x0000000002452dbe
#36 0x00007f07fca39341 __libc_start_main + 241
#37 0x00000000020ab129
mod_test.f90(37): 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.
do while (len(xyzs(s)%key(k)%val(b:)).gt.77)
--------------------^
compilation aborted for mod_test.f90 (code 3)
The code (which compiles fine with gfortran) is:
module mod_test
implicit none
type xyzk_t
! setting len=160 makes the ICE go away
character(len=:),allocatable :: nam,val
end type xyzk_t
type xyzs_t
! setting len=160 makes the ICE go away
character(len=:),allocatable :: sect
integer :: n_keys
type(xyzk_t),pointer :: key(:) =>null()
end type xyzs_t
integer :: n_xyz_sects
type(xyzs_t),pointer :: xyzs(:) =>null()
save
contains
subroutine show
integer :: s,k,b,e,ws
do s = 1, n_xyz_sects
write(*, '(a)') '#'
if (s.gt.1.or.xyzs(s)%sect.ne.'') write(*,'(4a)') '# [',xyzs(s)%sect,']'
do k = 1, xyzs(s)%n_keys
if (len(xyzs(s)%key(k)%nam)+len(xyzs(s)%key(k)%val).le.75) then
write(*,'(4a)') '# ',xyzs(s)%key(k)%nam,' = ',xyzs(s)%key(k)%val
else
write(*,'(3a)') '# ',xyzs(s)%key(k)%nam,' = \'
b = 1
do while (len(xyzs(s)%key(k)%val(b:)).gt.77)
e = b-1 + 77
ws = scan(xyzs(s)%key(k)%val(b:e),' ',back = .true.)
if (ws.gt.1) e = b-1 + ws
write(*,'(3a)') '# ',xyzs(s)%key(k)%val(b:e),'\'
b = e + 1
end do
write(*,'(2a)') '# ',xyzs(s)%key(k)%val(b:)
end if
deallocate(xyzs(s)%key(k)%nam,xyzs(s)%key(k)%val)
end do
deallocate(xyzs(s)%sect,xyzs(s)%key)
end do
deallocate(xyzs)
end subroutine show
end module mod_test
Is there a way to workaround the ICE?
Can the ICE be fixed in both ifort and ifx?
Thanks for reading so far.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this ICE. I filed a bug report, CMPLRLLVM-55194. Usually when both compilers ICE, a single fix fixes both because they share the same front end.
I don't immediately see a workaround. I asked the compiler engineer to let me know if he sees a workaround while triaging this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a workaround, which compiles with ifort and works correctly (it also compiles with ifx, but I haven't tested the execution):
$ diff -u mod_test.f90 workaround/mod_test.f90
--- mod_test.f90 2024-01-10 16:30:14.638877767 +0100
+++ workaround/mod_test.f90 2024-01-12 11:21:34.010259397 +0100
@@ -24,6 +24,8 @@
subroutine show
integer :: s,k,b,e,ws
+character(len=:),allocatable :: val
+
do s = 1, n_xyz_sects
write(*, '(a)') '#'
@@ -34,14 +36,16 @@
else
write(*,'(3a)') '# ',xyzs(s)%key(k)%nam,' = \'
b = 1
- do while (len(xyzs(s)%key(k)%val(b:)).gt.77)
+ val = xyzs(s)%key(k)%val
+ do while (len(val(b:)).gt.77)
e = b-1 + 77
- ws = scan(xyzs(s)%key(k)%val(b:e),' ',back = .true.)
+ ws = scan(val(b:e),' ',back = .true.)
if (ws.gt.1) e = b-1 + ws
- write(*,'(3a)') '# ',xyzs(s)%key(k)%val(b:e),'\'
+ write(*,'(3a)') '# ',val(b:e),'\'
b = e + 1
end do
- write(*,'(2a)') '# ',xyzs(s)%key(k)%val(b:)
+ write(*,'(2a)') '# ',val(b:)
+ deallocate(val)
end if
deallocate(xyzs(s)%key(k)%nam,xyzs(s)%key(k)%val)
end do
In other words, I changed the "show" subroutine into:
subroutine show
integer :: s,k,b,e,ws
character(len=:),allocatable :: val
do s = 1, n_xyz_sects
write(*, '(a)') '#'
if (s.gt.1.or.xyzs(s)%sect.ne.'') write(*,'(4a)') '# [',xyzs(s)%sect,']'
do k = 1, xyzs(s)%n_keys
if (len(xyzs(s)%key(k)%nam)+len(xyzs(s)%key(k)%val).le.75) then
write(*,'(4a)') '# ',xyzs(s)%key(k)%nam,' = ',xyzs(s)%key(k)%val
else
write(*,'(3a)') '# ',xyzs(s)%key(k)%nam,' = \'
b = 1
val = xyzs(s)%key(k)%val
do while (len(val(b:)).gt.77)
e = b-1 + 77
ws = scan(val(b:e),' ',back = .true.)
if (ws.gt.1) e = b-1 + ws
write(*,'(3a)') '# ',val(b:e),'\'
b = e + 1
end do
write(*,'(2a)') '# ',val(b:)
deallocate(val)
end if
deallocate(xyzs(s)%key(k)%nam,xyzs(s)%key(k)%val)
end do
deallocate(xyzs(s)%sect,xyzs(s)%key)
end do
deallocate(xyzs)
end subroutine show
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great! You can move forward!
I'll add this info to the bug report.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@frx, the ICE you reported for both ifx and ifort is fixed in a preview of the compilers that will be available in mid-2024. Watch for the 2024.2 release!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page