No distinction between COMPLEX and CMPLX in gfortran
Naveen Yadav
naveen.phys@gmail.com
Tue Dec 30 06:48:44 GMT 2025
Dear developers,
I am using GNU Fortran (GCC) 15.2.1 20251211 (Red Hat 15.2.1-5):
The following program:
****************************************************************************************************
PROGRAM test
IMPLICIT NONE
REAL :: a = 1.0, b=1.0
COMPLEX:: z
z = COMPLEX(1.0,2.0)
PRINT*, z
z = COMPLEX(a, b)
PRINT*, z
END PROGRAM test
****************************************************************************************************
works with gfortran. However, the Intel compiler (from oneApi) throws a
compile error:
test.f90(6): error #6404: This name does not have a type, and must have an
explicit type. [COMPLEX]
z = COMPLEX(1.0,2.0)
----^
compilation aborted for test.f90 (code 1)
It is because COMPLEX is the name of a type and CMPLX is an intrinsic
function. The behaviour of the Intel compiler is the correct one. I hope
this will be updated in a future release.
Best regards
Naveen Yadav
More information about the Gcc
mailing list