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

How to check for different character lengths in array constructor

Heinzeller__Dom
Beginner
1,047 Views

Hi everyone,

I am working on a large community code where many developers are using Intel only, others are using gfortran etc. We keep getting these kind of errors when using gfortran, because apparently the Intel compiler does not check for this by default and the developers are not aware of it:

...
attrList=(/"fhzero", "ncld", "nsoil", "imp_physics", "dtp"/), rc=rc)
                           1
Error: Different CHARACTER lengths (6/4) in array constructor at (1)

As far as I understand, this is part of the Fortran language standard and gfortran is correct (unless using deferred-length character arrays or other Fortran 2003+ features?) So, my question: which kind of compiler flag or switch do I have to use to make the Intel compiler exit with an error in this case?

Thanks very much in advance.

Dom

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,047 Views

I will also note that you can use:

attrList=(/character(11)::"fhzero", "ncld", "nsoil", "imp_physics", "dtp"/), rc=rc)

This is standard-conforming and does what Intel Fortran does as an extension.

View solution in original post

0 Kudos
3 Replies
Juergen_R_R
Valued Contributor I
1,047 Views

Try -e03 or -e08.

 

0 Kudos
FortranFan
Honored Contributor II
1,047 Views

-e compiler option is legacy and its use is now deprecated by Intel if I'm not mistaken.

What users should employ now is -warn stderrors

https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-warn#B4127230-7691-4ACB-8A20-D4C3E02B5C2D

0 Kudos
Steve_Lionel
Honored Contributor III
1,048 Views

I will also note that you can use:

attrList=(/character(11)::"fhzero", "ncld", "nsoil", "imp_physics", "dtp"/), rc=rc)

This is standard-conforming and does what Intel Fortran does as an extension.

0 Kudos
Reply