- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for clarifying and for the bug report!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fix will be available in the next oneAPI release.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having the same error with inteloneapi-2022.1.2. Is it fixed in a later version? If so, which one?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The example compiles successfully in the current ifx version (2025.1.0)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're spot on — the issue arises due to how ifort handles character arguments with assumed-rank and missing length metadata, especially for rank(0). Unlike gfortran, ifort expects a length parameter even if the rank is zero, and that’s why the compiler throws that error. It’s not exactly a bug, but more of a strict interpretation of Fortran standards in Intel’s implementation.
I ran into a similar issue while testing assumed-rank character handling across compilers and shared a few insights and workarounds here :executordelta.com — might be useful if you're aiming for cross-compiler compatibility.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page