Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
공지
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

ifx: ICE with check bounds

Philippe31
초급자
2,037 조회수

Hello,

 

I get an internal compiler error with ifx 2023.0.0 with this simple code:

> cat eoshift.f90  
FUNCTION ZA(PA)
IMPLICIT NONE
REAL, DIMENSION(:,:,:), INTENT(IN)                :: PA
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: ZA  
ZA(:,:,:) = EOSHIFT(PA(:,:,:),SHIFT=1,DIM=3)
END FUNCTION ZA

 

if I try to compile it with the -check bounds option:

> ifx -c -check bounds eoshift.f90  
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1f563ca]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1bef70e]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1c55e52]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1c55f80]
/lib64/libc.so.6(+0x4ad50)[0x14fb39444d50]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3afc702]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3b03395]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3b030c3]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3b0fa22]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3a98d52]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3a9b859]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x3a9a87c]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x2d22ced]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x2031303]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x2d1ad2d]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x2037cd0]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x2d1af0d]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x202fe87]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1b96f59]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1b955dd]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1b44a74]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1d028ee]
/lib64/libc.so.6(__libc_start_main+0xef)[0x14fb3942f29d]
/home/waup/installations/applications/oneapi/2023.0.0/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1982da9]

eoshift.f90: error #5633: **Internal compiler error: segmentation violation signal raised** 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 eoshift.f90 (code 3)

Without the -check bounds option, compilation is OK.

 

Regards,

 

Philippe

 

레이블 (1)
1 솔루션
Barbara_P_Intel
1,427 조회수

The ICE when compiling with "-check bounds" is gone. I just tested an early version of 2024.2.0. This version is planned for release in mid-2024.



원본 게시물의 솔루션 보기

0 포인트
9 응답
Barbara_P_Intel
1,999 조회수

Thank you for reporting this with such a nice reproducer. Of course, the workaround is to not compile with "-check bounds".  (Wink, since emojis don't work.)

I filed a bug report, CMPLRLLVM-45802. I'll let you know when it's fixed.

 

 

0 포인트
andrew_4619
명예로운 기여자 III
1,977 조회수

That code fails (ICE)  on IFX in Windows also,

Another work around might be:

       ! REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: ZA  
        real, allocatable :: ZA(:,:,:)

That still works with bounds check on and is more pleasing on the eye IMO!

0 포인트
JohnNichols
소중한 기여자 III
1,963 조회수
FUNCTION ZA(PA)
IMPLICIT NONE
REAL, DIMENSION(:,:,:), INTENT(IN)                :: PA
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: ZA  
ZA(:,:,:) = EOSHIFT(PA(:,:,:),SHIFT=1,DIM=3)
END FUNCTION ZA

@Philippe31  - it helps make the code easy to read if you put the code into the code box in the editor.  

 

I would have to agree with Andrew. 

0 포인트
jimdempseyatthecove
명예로운 기여자 III
1,962 조회수

Andrew,

ZA is the function name. Your code specifies (requires) that the callers returned-to variable/expression temporary be allocatable as well. In the OP's original code, the returned-to variable/expression temporary was (presumably) preallocated to the dimensions of that of the calling argument.

Note, with this function having a proper interface you can specify:

real :: ZA(:,:,:)

Jim Dempsey 

0 포인트
andrew_4619
명예로운 기여자 III
1,951 조회수

I would presume the automatic variable (array) ZA created in the function in the OPs post will be assigned to whatever the caller assigns it to whether that be allocatable or not. It is in essence the same both methods create a temporary array in the function and return that array and array descriptor. The onus is on the caller to ensure the assignment is to a compatible array IMO.  

 

 

0 포인트
JohnNichols
소중한 기여자 III
1,948 조회수

Very easy to make a mistake doing this. 

0 포인트
andrew_4619
명예로운 기여자 III
1,942 조회수

With explicit interfaces and bound checking on it is not easy to make a mistake, the compiler is your friend!

0 포인트
jimdempseyatthecove
명예로운 기여자 III
1,919 조회수

While I agree that, should this function be called returning very large arrays, the argument may require it be allocatable (such to avoid stack overflow). However, in doing so, may also require the code explicitly allocate the array should the results be generated in the return value (e.g. DO k=1,n; DO j=1,m; DO i=1,o; ... ZA(i,j,k) = scalar) as opposed to ZA = otherArrayOfDesiresShapeAndSize.

Jim Dempsey

0 포인트
Barbara_P_Intel
1,428 조회수

The ICE when compiling with "-check bounds" is gone. I just tested an early version of 2024.2.0. This version is planned for release in mid-2024.



0 포인트
응답