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 

FTN95 incorrectly flags 2-D array as scalar

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



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Sat Oct 13, 2018 1:39 am    Post subject: FTN95 incorrectly flags 2-D array as scalar Reply with quote

The subroutine code given below has no syntax errors (as checked by Gfortran). The local variable D5V is declared as a 2-dimensional array, and is assigned a rank-2 array expression in a WHERE statement on line 26.
Code:
Subroutine merit (l, m, me, n, r, df, g, dg, v, dphi, active)
!
!*********************************************************************
!
      Implicit None
!-----------------------------------------------
!   D u m m y   A r g u m e n t s
!-----------------------------------------------
      Integer, Intent (In) :: l, m, me, n
      Real, Intent (In)    :: df (n), g (m, l), dg (m, n), v (m), r (m)
      Real, Intent (Inout) :: dphi (m + n)
      Logical, Intent (Out) :: active (m)
!-----------------------------------------------
!   L o c a l   V a r i a b l e s
!-----------------------------------------------
      Integer :: j1
      Real :: d5v (m, n)              ! NOTE: Rank = 2
!-----------------------------------------------
!
      active = .True.
      Where ( (/ (j1, j1=1, m) /) > me .And. &
             r * g(:, 1) > v) active = .False.
!
      dphi (:n) = df
      Where (spread(active, dim=2, ncopies=n)) &
         d5v = dg (:, :) * (spread(v, dim=2, ncopies=n) &  ! FTN95 says d5v is SCALAR!
              - spread(r, dim=2, ncopies=n) &
              * spread(g(:, 1), dim=2, ncopies=n))
      dphi (:n) = dphi (:n) - sum (d5v, mask= &
                  spread(active, dim=2, ncopies=n), dim=1)
      Where (active)
         dphi (n+1:m+n) = - g (:, 1)
      Elsewhere
         dphi (n+1:m+n) = - v / r
      End Where
      Return
End Subroutine

The compiler says
Code:
[FTN95/Win32 Ver. 8.30.279 Copyright (c) Silverfrost Ltd 1993-2018]
0025)       Where (spread(active, dim=2, ncopies=n)) &
0026)          d5v = dg (:, :) * (spread(v, dim=2, ncopies=n) &  ! FTN95 says d5v is SCALAR!
0027)               - spread(r, dim=2, ncopies=n) &
0028)               * spread(g(:, 1), dim=2, ncopies=n))
*** The test of the enclosing WHERE statement is rank 2, whereas the left hand side of this assignment is a scalar
    1 ERROR  [<MERIT> FTN95 v8.30.279]
*** Compilation failed
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Oct 13, 2018 8:01 am    Post subject: Reply with quote

Thank you for the feedback. I have made a note that this needs investigating.
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