replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Interface bug?
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 

Interface bug?

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



Joined: 18 May 2012
Posts: 797
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Fri Mar 21, 2025 1:48 am    Post subject: Interface bug? Reply with quote

The following code compiles without error using FTN95.

In the main program the call to S1 (where the function F is an argument) returns the expected results.


The call to S2 also has the function F as an argument, and S2 itself calls S1 (passing F as an argument of this call to S1).

In this case, an access violation occurs when F is called within S1 i.e. when S1 has been called by S2.


I believe the required interfaces are in place, so I think this may be a bug with FTN95. This code runs successfully with other compilers.

Code:
module demo
implicit none
contains 
 
  subroutine s1(f,x,r)
  interface
    function f(x) result(y)
      implicit none
      real x, y
      end function f
  end interface
  real x, r
    r = f(x)       ! Access violation occurs here when S1 is CALLed from S2
  end subroutine s1

  subroutine s2(f,x,r)
  interface
    function f(x) result(y)
      implicit none
      real x, y
      end function f
  end interface
  real x, r
    call s1(f,x,r) 
  end subroutine s2
 
end module demo

program p
use demo
implicit none
interface
  function f(x) result(y)
    implicit none
    real x, y
    end function f
end interface
real x, r
  x = 2.0
  call s1(f,x,r)         ! This works
  print*, 'r =    ', r
  call s2(f,x,r)         ! This fails with FTN95
  print*, 'r =    ', r
end program p


function f(x) result(y)
implicit none
real x, y
  y = x*x
end function f
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Fri Mar 21, 2025 8:01 am    Post subject: Reply with quote

Thanks Ken. I have logged this for investigation.
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