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

Bug Report ICE: "catastrophic error" with ieee_arithmetic module's ieee_value (ifx 2024.2)

jeffhole
Novice
498 Views

Compiler: ifx (IFX) 2024.2.0 20240602 (ifx --version)

OS Rocky Linux 8.9 (Green Obsidian)

 

I encountered an interesting ICE when setting double precision complex number arrays to "NaN". I don't know if this is a misuse of the ieee_arithmetic's ieee_value(), or if it is standard-compliant, but here it is:

 

! file: test.f90
program main
    use, intrinsic :: ieee_arithmetic, only: ieee_value, ieee_quiet_nan
    implicit none
    complex(8), allocatable :: x(:)

    allocate(x(3))
    x = cmplx(ieee_value(x%re,ieee_quiet_nan), ieee_value(x%im,ieee_quiet_nan), kind=8)

    print *, x%im
end program

 

Compiling on the command line:

 

ifx test.f90

 

I get this compiler error message:

 

test.f90(8): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
    x = cmplx(ieee_value(x%re,ieee_quiet_nan), ieee_value(x%im,ieee_quiet_nan), kind=8)
^
test.f90(8): catastrophic error: Internal Compiler Error: Ref module: ffe_aexpr.c
compilation aborted for test.f90 (code 1)

 

Workaround

 I found a workaround which is to only pass a single value of x for the first argument of ieee_value():

 

! file: workaround.f90
program main
    use, intrinsic :: ieee_arithmetic, only: ieee_value, ieee_quiet_nan
    implicit none
    complex(8), allocatable :: x(:)

    allocate(x(3))
    x = cmplx(ieee_value(x(1)%re,ieee_quiet_nan), ieee_value(x(1)%im,ieee_quiet_nan), kind=8)

    print *, x%im
end program

 

This seems like the right thing to do. I wanted to share this solution and give the compiler team code to reproduce the error. Thanks!

Labels (2)
0 Kudos
1 Solution
Devorah_H_Intel
Moderator
334 Views

I reproduced the issue internally. Thank you for the report. This case has been escalated to compiler engineering.


View solution in original post

0 Kudos
3 Replies
JFH
Beginner
391 Views

@jeffhole's test.f90 program compiles and runs correctly with ifort. If one changes the kind 8 to either 4 or 16 it still crashes with ifx and runs correctly with ifort.

0 Kudos
Devorah_H_Intel
Moderator
335 Views

I reproduced the issue internally. Thank you for the report. This case has been escalated to compiler engineering.


0 Kudos
jeffhole
Novice
329 Views

Thanks @JFH for checking this against ifort. Good thing to know.

 

You're welcome, @Devorah_H_Intel! Glad to help!

0 Kudos
Reply