forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DO-loop accepting shape intrinsic as upper limit

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Andre



Joined: 19 Jan 2017
Posts: 14

PostPosted: Fri Feb 24, 2017 9:37 am    Post subject: DO-loop accepting shape intrinsic as upper limit Reply with quote

The following code compiles fine in ftn95 (32bit) which it shouldn't.
shape(a) returns an integer array, but the upper limit of a DO loop must be scalar.
Code:

subroutine foo(a)
    implicit none
    integer, intent(in) :: a(:,:)

    integer :: i

    print *, 'Shape of a:', shape(a)

    do i = 1, shape(a) ! <-- This should be size(shape(a))
        print *, 'Dimension', i, 'of a has', size(a, i), 'elements'
    enddo
end subroutine

Interestingly, adding /iso yields the same result but if used with /64 /iso, the compiler fails with
Code:

...
0009)     do i = 1, shape(a)
*** DO upper limit must be scalar valued
...

which is the correct behaviour.
Summarized:
ftn95 foo.f95 -> Compiles
ftn95 /iso foo.f95 -> Compiles
ftn95 /64 foo.f95 -> Compiles
ftn95 /64 /iso foo.f95 -> Fails (correct behavior).

Best,
André
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Feb 25, 2017 9:23 am    Post subject: Reply with quote

Thank you. I have made not of this.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Mar 23, 2017 10:43 am    Post subject: Reply with quote

This has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group