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 

Bug in 8.3 - error passing automatic array

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



Joined: 17 Jul 2009
Posts: 553
Location: UK

PostPosted: Fri Apr 20, 2018 10:10 am    Post subject: Bug in 8.3 - error passing automatic array Reply with quote

In the code below an automatic array freq is declared since the extents of each dimension are defined variables in the module.

This code is ANSI/ISO compliant.

When run with /CHECKMATE enabled the following error message is provided. The error happens when trying to make the call to scale_vector.

*** Error 14, Attempt to alter an actual argument that is a constant, an
expression, an INTENT(IN) argument, or a DO variable

This error occurs with 32 bit (whether debugging or not).

Using the 64 bit compiler and /CHECKMATE the code works but the debugger doesn't work (it doesn't open).

This code works in version 7.2 and 8.05.

Code:

module proc_mod

   integer :: num
   integer :: bins

contains

   subroutine run_analysis
      bins = 40
      num = 1
      call process
   end subroutine run_analysis

   subroutine process
   
      integer :: k, k1

      ! Automatic array
      integer, dimension(bins,num) :: freq

      freq = 0

      do k=1, num
         call scale_vector(freq(:,k), 100, k1)
      end do
   
   contains

      subroutine scale_vector(c, n, nn)
         integer, intent(in) :: n
         integer, intent(out) :: nn
         integer, intent(inout) :: c(:)
         print *,'subroutine was called'
      end subroutine scale_vector

   end subroutine process
   
end module proc_mod

program main

   use proc_mod, only: run_analysis

   call run_analysis

end program main

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2006
Location: Sydney

PostPosted: Fri Apr 20, 2018 12:42 pm    Post subject: Reply with quote

I could not reproduce the error using Ver 8.30.0 or Ver8.30 + dll.23

I tried:
ftn95 /64 /check /lgo david.f90 (this ran to completion)

ftn95 /64 /check david.f90 /link
slink64 david.exe
I stepped through with F7 to completion

My ftn95.cfg file (since 2003) is:
/ERROR_NUMBERS
/IMPLICIT_NONE
/INTL
/LOGL
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1031

PostPosted: Fri Apr 20, 2018 12:58 pm    Post subject: Reply with quote

I see the bug with /checkmate in 32-bit FTN95 8.30. Furthermore, the line number displayed in the traceback (or the highlighted line in SDBG) is wrong -- 27 is the line with "contains", whereas the subroutine statement is on line 29.

I see no problems stepping through the program to the end in SDBG64.

The test program does have one error: SCALE_VECTOR has an INTENT(OUT) argument that is never defined in the subroutine. Rather than flag that defect, the compiler simply warns that the variable NN is unused.
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 553
Location: UK

PostPosted: Sat Apr 21, 2018 12:12 am    Post subject: Reply with quote

mecej4, there is no error. Just because a variable is intent(out) doesn't mean the subroutine needs to define it.

All this code does is set the variable to undefined (or it should if it was working). In fact this is where the bug must lie since using /CHECK does not give a run time error and using /CHECKMATE does.

The bug occurs when running in 32 bit mode; John's tests were on 64 bit.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Apr 23, 2018 10:47 am    Post subject: Reply with quote

This has been fixed by removing the argument checking in this context. The fix will be in the next release of FTN95.

It is worth noting that the problem arises in the context passing a section of an automatic array (that is within a module procedure) to an internal subroutine. In other words a CONTAINS within a CONTAINS.

In the meantime there are various ways to avoid the failure. You can use /check rather than /checkmate - the problem relates to checking for incorrect INTENT(OUT) usage. Alternatively you can use /inhibit_check 14.
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 553
Location: UK

PostPosted: Mon Apr 23, 2018 5:01 pm    Post subject: Reply with quote

Paul,
Thanks. Using /inhibit_check 14 resolves this issue with the 32 bit compiler until the next release. I don't want to turn off /CHECKMATE because I am generally glad of the additional checking over /CHECK.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
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