Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler error: switch arguments #603

Merged
merged 2 commits into from
Nov 24, 2020

Conversation

rafmudaf
Copy link
Collaborator

Feature or improvement description
On my Mac with Intel Fortran compiler 19.1.2.258 20200623, I get this error when compiling nwtclibs on the dev branch:

Scanning dependencies of target nwtclibs
[  1%] Building Fortran object modules/nwtc-library/CMakeFiles/nwtclibs.dir/src/SingPrec.f90.o
[  1%] Building Fortran object modules/nwtc-library/CMakeFiles/nwtclibs.dir/src/NWTC_Base.f90.o
[  1%] Building Fortran object modules/nwtc-library/CMakeFiles/nwtclibs.dir/src/SysIFL.f90.o
[  1%] Building Fortran object modules/nwtc-library/CMakeFiles/nwtclibs.dir/src/NWTC_Library_Types.f90.o
[  2%] Building Fortran object modules/nwtc-library/CMakeFiles/nwtclibs.dir/src/NWTC_IO.f90.o
/Users/rmudafor/Development/openfast/modules/nwtc-library/src/NWTC_IO.f90(3369): error #6415: This name cannot be assigned this data type because it conflicts with prior uses of the name.   [ARYLEN]
      INTEGER,             INTENT(IN)             :: AryLen                        !< The length of the array to parse.
-----------------------------------------------------^
compilation aborted for /Users/rmudafor/Development/openfast/modules/nwtc-library/src/NWTC_IO.f90 (code 1)
make[2]: *** [modules/nwtc-library/CMakeFiles/nwtclibs.dir/src/NWTC_IO.f90.o] Error 1
make[1]: *** [modules/nwtc-library/CMakeFiles/nwtclibs.dir/all] Error 2
make: *** [all] Error 2

I think this is due to to the subroutine using an intent-in variable, AryLen, before it is declared:

   SUBROUTINE ParseChAry ( FileInfo, LineNum, AryName, Ary, AryLen, ErrStat, ErrMsg, UnEc )

         ! Arguments declarations.

      TYPE (FileInfoType), INTENT(IN)             :: FileInfo                      !< The derived type for holding the file information.
      INTEGER(IntKi),      INTENT(INOUT)          :: LineNum                       !< The number of the line to parse.
      CHARACTER(*),        INTENT(IN)             :: AryName                       !< The array name we are trying to fill.
      CHARACTER(*),        INTENT(OUT)            :: Ary(AryLen)                   !< The array to receive the input values.
      INTEGER,             INTENT(IN)             :: AryLen                        !< The length of the array to parse.
      INTEGER(IntKi),      INTENT(OUT)            :: ErrStat                       !< The error status.
      CHARACTER(*),        INTENT(OUT)            :: ErrMsg                        !< The error message, if ErrStat /= 0.
      INTEGER,             INTENT(IN), OPTIONAL   :: UnEc                          !< I/O unit for echo file. If present and > 0, write to UnEc.

Simply swapping AryLen and Ary declarations allows ifort to continue.

Related issue, if one exists
None.

Impacted areas of the software
Compiling with Intel Fortran 19 on macOS.

Additional supporting information
Unfortunately, we cannot easily add a test to capture this since we can't easily configure the CI to use the Intel compiler.

@rafmudaf rafmudaf self-assigned this Nov 24, 2020
@rafmudaf rafmudaf merged commit 17ff076 into OpenFAST:dev Nov 24, 2020
@rafmudaf rafmudaf deleted the bugfix/argswitch branch November 24, 2020 23:42
@rafmudaf rafmudaf mentioned this pull request Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant