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

Internal compiler error with coarray code -- ifort and ifx

NCarlson
New Contributor I
1,324 Views

Here's a reproducer that triggers an ICE with both ifort 2021.9.0 and ifx 2023.1.0. Use of the CONTIGUOUS attribute seems to be what triggers the ICE, but only when the coarray is a dummy argument in the calling program unit.

 

 ifort -coarray -coarray-num-images=2 intel-20230603.f90 
intel-20230603.f90(39): 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 intel-20230603.f90 (code 1)

 

 

module mod
  implicit none
contains
  subroutine sub0(a)
    real, intent(inout) :: a(:)[*]
    call sub1(a)
  end subroutine
  subroutine sub1(a)
    real, intent(inout) :: a(:)[*]
    if (this_image() < num_images()) call sub2(a, a(:)[this_image()+1])
  end subroutine
  subroutine sub2(x, y)
    real, contiguous, intent(inout) :: x(:), y(:) ! CONTIGUOUS TRIGGERS ICE
    if (any(x /= y)) error stop
  end subroutine
end module
use mod
real, allocatable :: a(:)[:]
allocate(a(2)[*])
a = [1, 2]
sync all
call sub1(a)
end

 

 

 

6 Replies
Barbara_P_Intel
Employee
1,293 Views

Thanks for reporting this with a simple reproducer! I filed a bug CMPLRLLVM-48333. I'll keep you posted on a fix.


jdelia
New Contributor I
1,271 Views

Dear all,

It seems that when sub0 doesn't also have the contiguous attribute the error is thrown, for example, consider the slightly modified version and the two tests,

 

$ cat /proc/version
Linux version 6.3.5-100.fc37.x86_64 (mockbuild@bkernel02.iad2.fedoraproject.org) (gcc (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1), GNU ld version 2.38-27.fc37) #1 SMP PREEMPT_DYNAMIC Tue May 30 15:43:51 UTC 2023
$ ifort --version
ifort (IFORT) 2021.9.0 20230302
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.
$ ifort -warn all -coarray -O2 -o test-contiguous-ifort.exe -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -ldl test-contiguous.f90
$ ifx --version
ifx (IFX) 2023.1.0 20230320
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
$ ifx -warn all -coarray -O2 -o test-contiguous-ifx.exe -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -ldl test-contiguous.f90
$ export FOR_COARRAY_NUM_IMAGES=2
$ test-contiguous-ifort.exe 
 sub2: any (xx .ne. yy): FALSE
$ test-contiguous-ifx.exe 
 sub2: any (xx .ne. yy): FALSE
module m_mod
  implicit none
contains
  !
  subroutine sub0 (aa)
    real, contiguous, intent (inout) :: aa (:) [*] <-- This is ok
   !real, intent (inout) :: aa (:) [*] ! SEE ERROR
    call sub1 (aa)
    ! test-contiguous.f90(8): error #8372:
    ! If the dummy argument is declared CONTIGUOUS,
    ! the actual argument must be simply contiguous.   [AA]
  end subroutine sub0
  !
  subroutine sub1 (aa)
    real, contiguous, intent (inout) :: aa (:) [*]
    real, allocatable :: bb (:)
    integer :: ti, ni, nn
    !
    ti = this_image()
    ni = num_images()
    !
    if (ti < ni) then
      nn = size (aa)
      allocate (bb (nn))
      bb (:) = aa (:) [ti+1]
      call sub2  (aa,bb)
      deallocate (bb)
    end if
    !
    sync all
    !
  end subroutine sub1
  !
  subroutine sub2 (xx,yy)
    real, contiguous, intent (inout) :: xx(:), yy(:)
    if (any (xx .ne. yy)) then
      error stop "sub2: any (xx .ne. yy): TRUE "
    else
      write (*,*)"sub2: any (xx .ne. yy): FALSE" 
    end if
  end subroutine sub2
  !
end module m_mod
!
program test_contiguous
  use m_mod
  real, allocatable :: aa (:) [:]
  integer :: ti, ni
  !
  ti = this_image()
  ni = num_images()
  !
  allocate (aa (2) [*])
  aa (1) = 1.0
  aa (2) = 2.0
  !
  call sub1  (aa)
  deallocate (aa)
  !
end program test_contiguous

 

 Regards.

Barbara_P_Intel
Employee
1,265 Views

@jdelia, thank you! That gives @NCarlson a good workaround.


0 Kudos
FortranFan
Honored Contributor III
1,172 Views

@Barbara_P_Intel wrote:

@jdelia, thank you! That gives @NCarlson a good workaround.


@Barbara_P_Intel ,

You may instead want to alert the unwary readers there is a systemic issue here involving ICE with both IFORT and IFX and thus to not count on any workarounds.  Landmines can be faulty also and may not go off when you step on them once!  ICEs are like landmines.  Don't count on miracles happening twice with them and it's best to avoid the areas altogether until they are cleared!

This simple reproducer shows there is a basic issue with Intel compilers that lead to ICE:

contains
   subroutine sub1( a )
      real, intent(inout) :: a(:)[*] !<-- adding CONTIGUOUS attribute makes no difference
      call sub2( a(:)[1] )
   end subroutine
   subroutine sub2( a )
      real, contiguous, intent(inout) :: a(:)
   end subroutine
end
C:\temp>ifort /c /standard-semantics /Qcoarray /free p.f
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.9.0 Build 20230302_000000
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.

p.f(4): 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 p.f (code 1)

 

Barbara_P_Intel
Employee
1,158 Views

@FortranFan, you are correct. "Let the buyer beware" on this workaround.


0 Kudos
Barbara_P_Intel
Employee
941 Views

I am happy to report that in the compiler release this week neither ifx nor ifort report an internal compiler error (ICE).

Please try the new release!



Reply