Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26758 Discussions

How to check for different character lengths in array constructor

Heinzeller__Dom
Beginner
343 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
343 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
343 Views

Try -e03 or -e08.

 

FortranFan
Honored Contributor II
343 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
344 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

Reply