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

Issue with complex part designators

jackie-san
Beginner
347 Views

I'm still experiencing what I believe to be a bug when attempting to use complex part designators in I/O read statements, specifically when using complex arrays. Consider the below extremely simple test example: 

program test_complex
implicit none

complex :: z(2)

read(*,*) z(1)%re

end program test_complex


Compiling with the latest ifx version produces the error:

ifx -o test_complex.x test_complex.f90
test_complex.f90(6): error #6358: Constants and expressions are invalid in read-only I/O lists. [REAL]
read(*,*) z(1)%re
^
compilation aborted for test_complex.f90 (code 1)


That is, it's still treating z(1)%re as an expression, rather than a variable. This appears to be a problem purely in read statements. Passing z(1)%re as an actual argument to a dummy argument with intent(out) or intent(inout) successfully compiles and runs as expected with the latest ifx version (this previously also errored).
I believe the above code sample is standard-conforming, and it compiles successfully with gfortran 11.4.0. As a note, if I attempt to read in the real part for each element of the array as read(*,*) z%re, this compiles without a problem. As soon as I take a slice, even of the full array i.e. z(:)%re, it gives an error.
Can anyone confirm whether this is still a bug re. complex part designators with the compiler?

0 Kudos
0 Replies
Reply