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

Bug: ifx does not assign back the real/imaginary part of the component of a structure

WiserOrb
Novice
198 Views

In the program i pass the real part of a component of a structure to the subroutine foo that set a value

 

However the matrix A is not changed by the procedure call

If I pass a matrix that is NOT a component, it correctly modifies it

 

main.f90

program main
    type :: Bar
        complex(kind=8) :: A(2)
    end type
    
    type(Bar) :: x
    
    x%A%re = 1.0_8
    x%A%im = 2.0_8
    
    call foo(3.0_8, x%A%re)
    
    write (*,*) x%A
    
    contains
    
    subroutine foo(v, A)
    real(kind=8) :: v, A(:)
    integer(kind=4) :: i
    
    A = v
    
    write(*,*) A
  end subroutine
end program

 

Output of ifx version 2025.1.1

3.00000000000000        3.00000000000000
 (1.00000000000000,2.00000000000000) (1.00000000000000,2.00000000000000)

 

The output should be:

   3.00000000000000        3.00000000000000
 (3.00000000000000,2.00000000000000) (3.00000000000000,2.00000000000000)
0 Kudos
1 Reply
Xiaoping_D_Intel
Employee
74 Views

I can reproduce the error and will open a bug report for it.


Reply