Re: No distinction between COMPLEX and CMPLX in gfortran

Paul Richard Thomas via Gcc <[email protected]>
Newsgroups gmane.comp.gcc.devel,gmane.comp.gcc.fortran
Message-ID <CAGkQGiKjPg+K791UmbfdijN+Bf5hy+5AVbape-PSu_aUXsT+dQ@mail.gmail.com>
Hi Andrew and Naveen,

pault@fedora:~/prs/pdt$ gfortran ../complex.f90 -std=f2018
../complex.f90:6:6:

    6 |   z = COMPLEX(1.0,2.0)
      |      1
Error: Function ‘complex’ at (1) has no IMPLICIT type
../complex.f90:9:6:

    9 |   z = COMPLEX(a, b)
      |      1
Error: Function ‘complex’ at (1) has no IMPLICIT type

The result is the same with -std=f95.

Regards

Paul


On Tue, 30 Dec 2025 at 07:00, Andrew Pinski <[email protected]>
wrote:

> On Mon, Dec 29, 2025 at 10:50 PM Naveen Yadav via Gcc <[email protected]>
> wrote:
> >
> > 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.
>
> See
> https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gfortran/COMPLEX.html#index-COMPLEX
> ```
> Standard:
> GNU extension
> ```
>
> Thanks,
> Andrew
>
> >
> > Best regards
> > Naveen Yadav
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.