Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

How to check for different character lengths in array constructor

Heinzeller__Dom
Beginner
614 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
Black Belt Retired Employee
614 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

3 Replies
Juergen_R_R
Valued Contributor I
614 Views

Try -e03 or -e08.

 

FortranFan
Honored Contributor II
614 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-4...

Steve_Lionel
Black Belt Retired Employee
615 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.

Reply