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

Miscompilation when passing real or imaginary of a complex array

WiserOrb
Novice
725 Views

Ifx miscopiles when passing the real or complex part of an explicit shape array to a procedure

Ifort instead provides the expected output

 

Notice that I have specified the intent(in)

When i specify any other intent ifx crashes

 

 

main.f90

 

program main
  complex :: x(3)

  x(1)%re = 1
  x(2)%re = 2
  x(3)%re = 3
  
  x(1)%im = 4
  x(2)%im = 5
  x(3)%im = 6
  
  write(*,*) x
  
  call foo(x%re)
  call foo(x%im)
  contains
  
  subroutine foo(x)
    real, intent(in) :: x(3)
    
    write(*,*) "x", x
  end subroutine
end program

 

 

 

ifx main.f90; ./a.out
(1.000000,4.000000) (2.000000,5.000000) (3.000000,6.000000)
 x   1.000000       4.000000       2.000000    
 x   1.000000       4.000000       2.000000

 

 

 

ifort instead provides the correct output

 

ifort main.f90; ./a.out
 (1.000000,4.000000) (2.000000,5.000000) (3.000000,6.000000)
 x   1.000000       2.000000       3.000000    
 x   4.000000       5.000000       6.000000 

 

 

 

ifx crash without specifying intent(in):

main.f90(1): 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.
program main
^
compilation aborted for main.f90 (code 3)

 

 

1 Solution
Devorah_H_Intel
Moderator
385 Views

The fix for this issue will be included in the future 2025 ifx 

 
$  ifx f10.f90 -o f10 -what && ./f10
 Intel(R) Fortran xxxxxxx
 (1.000000,4.000000) (2.000000,5.000000) (3.000000,6.000000)
 x   1.000000       2.000000       3.000000
 x   4.000000       5.000000       6.000000
​

View solution in original post

0 Kudos
4 Replies
rory586
Beginner
600 Views

Hello,


@WiserOrb wrote:

Ifx miscopiles when passing the real or complex part of an explicit shape array to a procedure

Ifort instead provides the expected output

 

Notice that I have specified the intent(in)

When i specify any other intent ifx crashes

 

 

main.f90

 

 

program main
  complex :: x(3)

  x(1)%re = 1
  x(2)%re = 2
  x(3)%re = 3
  
  x(1)%im = 4
  x(2)%im = 5
  x(3)%im = 6
  
  write(*,*) x
  
  call foo(x%re)
  call foo(x%im)
  contains
  
  subroutine foo(x)
    real, intent(in) :: x(3)
    
    write(*,*) "x", x
  end subroutine
end program

 

 

 

 

 

ifx main.f90; ./a.out
(1.000000,4.000000) (2.000000,5.000000) (3.000000,6.000000)
 x   1.000000       4.000000       2.000000    
 x   1.000000       4.000000       2.000000

 

 

 

 

ifort instead provides the correct output

 

 

ifort main.f90; ./a.out
 (1.000000,4.000000) (2.000000,5.000000) (3.000000,6.000000)
 x   1.000000       2.000000       3.000000    
 x   4.000000       5.000000       6.000000 

 

 

 

 

ifx crash without specifying intent(in):

 

main.f90(1): 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.
program main
^
compilation aborted for main.f90 (code 3)

 

 

 


Something's wrong with your computer program.

It's like trying to put together a puzzle with missing pieces. Let's figure out how to fix it.

0 Kudos
WiserOrb
Novice
539 Views

I believe ifx doesn't pass the correct stride to the subroutine.

 

If we assume ifx packs complex numbers with alternating real and imaginary part the x vector has flat an in memory representation:

 

[1, 4, 2, 5, 3, 6]

 

When I pass the real part of the array, ifx should pass an array with stride 2 starting from the first entry of the array

 

[1, _, 2, _, 3, _]

 

However i think ifx is setting the stride to one, so the subroutine sees:

 

[1, 4, 2]

 

Then there is the compiler crash when I'm not specifying `intent(in)` in the subroutine, but I cant debug it without access to the ifx source code  

Devorah_H_Intel
Moderator
460 Views

Thank you for reporting this to us. I have escalated this issue to our compiler engineering team. 

0 Kudos
Devorah_H_Intel
Moderator
386 Views

The fix for this issue will be included in the future 2025 ifx 

 
$  ifx f10.f90 -o f10 -what && ./f10
 Intel(R) Fortran xxxxxxx
 (1.000000,4.000000) (2.000000,5.000000) (3.000000,6.000000)
 x   1.000000       2.000000       3.000000
 x   4.000000       5.000000       6.000000
​
0 Kudos
Reply