Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
10 Views

How to check for different character lengths in array constructor

Jump to solution

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

Accepted Solutions
Highlighted
Black Belt
10 Views

I will also note that you can

Jump to solution

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.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran

View solution in original post

0 Kudos
3 Replies
Highlighted
Valued Contributor I
10 Views

Try -e03 or -e08.  

Jump to solution

Try -e03 or -e08.

 

0 Kudos
Highlighted
Valued Contributor III
10 Views

-e option is legacy I believe

Jump to solution

-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...

0 Kudos
Highlighted
Black Belt
11 Views

I will also note that you can

Jump to solution

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.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran

View solution in original post

0 Kudos