Search code examples
fortranintel-fortranfortran95fortran2003

warning "an elemental intrinsic function here be of type integer or character"


I had a line in my code

real(8)::pi=4*atan(1D0)

I compiled it with ifort /stand:03 and it warns me

fortran-learning.f90(3): warning #6009: Fortran 2003 specifies that an elemental intrinsic function here be of type integer or character and each argument must be an initialization expr of type integer or character. [ATAN]

        real(8)::pi=4*atan(1D0)
----------------------^

What does this mean?


Solution

  • This compiler bug has been fixed in recent versions. See here for details.

    In Fortran 95, the initialization expressions (constant expressions) were a lot stricter than they are now. The expression you use was not officially supported - hence the warning. When this restriction was lifted in Fortran 2003, Intel didn't fix the warning right away - see the linked article. Just in case you want to track this, the Intel Issue ID is DPD200253798.

    By the way, it is just a warning. You can easily disable it with

    -diag-disable 6009
    

    or on Windows:

    /Qdiag-disable:6009