- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have noticed that the SIZE intrinsic function does not work on scalar - it does work on assumed-rank arguments that are actually scalars, whereas the Fortran 2018 standard allows this.
Here is a sample program to demonstrate it.
! chkrank.f90 --
! Check an idea regarding ranks and scalars ...
!
program chkrank
implicit none
integer :: x
call printsize( x )
!
! This is not allowed ... take it out and the program runs fine
!
write(*,*) size(x)
contains
subroutine printsize( y )
integer :: y(..)
write(*,*) size(y)
end subroutine printsize
end program chkrank
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hm, I just got a message that this conclusion is NOT actually valid. So, perhaps my post should throw up the question whether this is allowed or not. It does seem like an unnecessary restriction, but I may be too hasty in concluding that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"ARRAY shall be assumed-rank or an array."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your post is rather confusing, the comment in the code snippet is the opposite to your statement with "whereas the Fortran 2018 standard allows this" in the post. So it's all fuzzy as to what is the point here, particularly in the context of Intel Fortran.
As you appear to have realized later, the current Fortran 2018 standard is clear on this, as pointed out by @Steve_Lionel : the argument to the SIZE intrinsic "shall be assumed-rank or an array" and Intel Fortran compiler detects and reports nonconformance. So perhaps you agree there is nothing further to discuss on this forum? You can follow-up elsewhere if you propose any changes for Fortran 202Y or later revisions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Indeed, the matter is quite clear. I stumbled upon this matter as part of a larger conversation regarding some of the new features in Fortran 2023 and we thought that somehow Intel Fortran was incorrect (gfortran version 10.2.0 issues the same complaint, but that is a relatively old version). Therefore the question we discussed transcends the current standard and has nothing specific to do with the compiler.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page