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

Assumed Rank Character Variable Fails in Select Rank Statement

CarlB
Beginner
1,204 Views

 

Hello everyone,

 

This function compiles with all data types using gfortran. ifort, however, fails if I try to define a behaviour for rank(0). Higher ranks do work, including rank default.

Minimal example:

subroutine sub(c)
character(*), intent(in) :: c(..)

select rank(c)
rank(0)
   print*, 0
end select
end subroutine sub

 Result:

$ ifort -c ./src/lib.f90 -warn all -check all -error-limit 1 -O0 -g -assume byterecl -traceback -module build/ifort_5C58216731706F11/testingrange -Ibuild/ifort_5C58216731706F11/testingrange  -o build/ifort_5C58216731706F11/testingrange/src_lib.f90.o
./src/lib.f90(10): error #5529: CHARACTER variable 'C' has no length argument in routines with C or STDCALL attribute
select rank(c)
------------^

 Compiler provided by my company:

ifort (IFORT) 19.1.2.254 20200623

 

Is this a bug or a feature? At least the error message isn't that clear.

I assume it has something to do with the additional len parameter of the character type. But I'm curious because it does compile and work with gfortran.

 

Best,
Carl

0 Kudos
1 Solution
Barbara_P_Intel
Employee
1,146 Views

I got the same wrong error message with the current compiler release, 2021.3.0. I filed a bug report, CMPLRIL0-34096, on your behalf. I'll keep you posted on its progress to a fix.



View solution in original post

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
1,181 Views

Bug.

0 Kudos
Barbara_P_Intel
Employee
1,147 Views

I got the same wrong error message with the current compiler release, 2021.3.0. I filed a bug report, CMPLRIL0-34096, on your behalf. I'll keep you posted on its progress to a fix.



0 Kudos
CarlB
Beginner
1,098 Views

Thank you for clarifying and for the bug report!

0 Kudos
Devorah_H_Intel
Moderator
888 Views

The fix will be available in the next oneAPI release. 

0 Kudos
Reply