- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the following 5 subroutines should be all valid Fortran (and are accepted by NAG), but only the first 3 are accepted, while the last 2 are rejected:
subroutine s (x)
class(*), allocatable :: x(:)
if (allocated (x)) print *, size (x)
end
subroutine s1 (x)
class(*) :: x(:)
allocatable :: x
if (allocated (x)) print *, size (x)
end
subroutine s2 (x)
class(*) :: x
dimension :: x(:)
allocatable :: x
if (allocated (x)) print *, size (x)
end
subroutine s3 (x)
class(*) :: x
allocatable :: x
dimension :: x(:)
if (allocated (x)) print *, size (x)
end
subroutine s4 (x)
class(*) :: x
allocatable :: x(:)
if (allocated (x)) print *, size (x)
end
I get:
% ifx -c ifort-class-arg.f90ifort-class-arg.f90(19): error #6646: ALLOCATABLE or POINTER attribute dictates a deferred-shape-array. [X]
subroutine s3 (x)
---------------^
ifort-class-arg.f90(28): error #6427: This dummy scalar or array is invalid in this context. [X]
allocatable :: x(:)
-----------------^
ifort-class-arg.f90(29): error #7397: The argument of the ALLOCATED inquiry intrinsic function should have the ALLOCATABLE attribute. [X]
if (allocated (x)) print *, size (x)
-----------------^
ifort-class-arg.f90(29): error #6830: The argument of the ALLOCATED intrinsic cannot be a constant or an expression. [X]
if (allocated (x)) print *, size (x)
-----------------^
ifort-class-arg.f90(29): error #6361: An array-valued argument is required in this context. [SIZE]
if (allocated (x)) print *, size (x)
------------------------------------^
compilation aborted for ifort-class-arg.f90 (code 1)
Same with the classic variant. I think this a compiler issue.
Thanks,
Harald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those false error messages are gone with the Fortran compilers that were released last week as 2024.1. Please give them a try.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, this is a compiler bug, albeit one that I find astonishing.
I will also note that the first error message is incorrect in that one can have a POINTER or ALLOCATABLE that is a scalar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this. Bug filed, CMPLRLLVM-45454. I'll let you know when it's fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those false error messages are gone with the Fortran compilers that were released last week as 2024.1. Please give them a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it is fixed. Thanks!

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