replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Label@ routine
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 

Label@ routine

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
Moji



Joined: 30 Sep 2020
Posts: 33

PostPosted: Thu Aug 07, 2025 2:42 pm    Post subject: Label@ routine Reply with quote

Hello,
I become a run time error in the following test program as I enter the JUMP_Sub for the second time in 64-bit mode. In 32-bit, I can enter the JUMP_Sub recursively without problem, as I expected.
Apart from that, I had also difficulties, in debugging the code and finding the reason of error in our program. As you can see, the run time error apears in Interface_Sub, although this subroutine has no silverfrost function in it. Here is the test code:
Code:
Module MTest
   Complex (Kind=2)   :: komp
End Module

Program Test_Label
      Use MTest
      Integer a

      komp = (0.D0, 0.D0)
100   Write(*,*) 'Enter a number: '
      Read(*,*) a
      Call LABEL@ (komp,*200)
      Call Interface_Sub()
200   Continue
      Write(*,*) 'Next'
      Goto 100
End Program

Subroutine Interface_Sub()
   Write(*,*) 'within Interface_Sub'
   Call Jump_Sub()
End Subroutine

Subroutine Jump_Sub()
   Use MTest
   Call Jump@(komp)
End Subroutine
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Aug 07, 2025 3:35 pm    Post subject: Reply with quote

Moji

LABEL@ and JUMP@ are implemented but not documented for x64.

At first sight it looks like they work like this for x64...

Code:
Module MTest
   integer LAB1
End Module

Program Test_Label
      Use MTest
      Integer a
      Call LABEL@(LAB1)
100   Write(*,*) 'Enter a number: '
      Read(*,*) a
      Call Interface_Sub()
      Write(*,*) 'Next'
      Goto 100
End Program

Subroutine Interface_Sub()
   Write(*,*) 'within Interface_Sub'
   Call Jump_Sub()
End Subroutine

Subroutine Jump_Sub()
   Use MTest
   Call Jump@(LAB1)
End Subroutine


The call to LABEL@ takes one argument that could be of any type. The point where LABEL@ is called sets a label using the address of the argument.

In this sample program 'Next' is not printed and a jump is made directly to the point immediately after the call to LABEL@ which is the same as the explicit 100.

LAB1 does not need a value and the explicit label 100 is not used.
Back to top
View user's profile Send private message AIM Address
Moji



Joined: 30 Sep 2020
Posts: 33

PostPosted: Thu Aug 07, 2025 4:11 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
Moji

LABEL@ and JUMP@ are implemented but not documented for x64.

At first sight it looks like they work like this for x64...

Code:
Module MTest
   integer LAB1
End Module

Program Test_Label
      Use MTest
      Integer a
      Call LABEL@(LAB1)
100   Write(*,*) 'Enter a number: '
      Read(*,*) a
      Call Interface_Sub()
      Write(*,*) 'Next'
      Goto 100
End Program

Subroutine Interface_Sub()
   Write(*,*) 'within Interface_Sub'
   Call Jump_Sub()
End Subroutine

Subroutine Jump_Sub()
   Use MTest
   Call Jump@(LAB1)
End Subroutine


The call to LABEL@ takes one argument that could be of any type. The point where LABEL@ is called sets a label using the address of the argument.

In this sample program 'Next' is not printed and a jump is made directly to the point immediately after the call to LABEL@ which is the same as the explicit 100.

LAB1 does not need a value and the explicit label 100 is not used.

Paul
Thanks for the explanation. Now I understand how it actually works. However, it doesn't solve the issue. I tested your code also, and it still gives me a runtime error, this time for 64bit and 32bit. In 32bit, right after the first call of LABEL@. The 64bit program behaves different than 32bit, and same as my test program, the first time that the JUMP@ is called, it works fine. But before JUMP@ is called for the second time, the error happens.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Aug 07, 2025 4:45 pm    Post subject: Reply with quote

Moji

You can't use the same code for both Win32 and x64.

For x64 you can start with my template and vary it according to your needs.

If the result does not work then please post a sample.
Back to top
View user's profile Send private message AIM Address
Moji



Joined: 30 Sep 2020
Posts: 33

PostPosted: Fri Aug 08, 2025 7:38 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
Moji

You can't use the same code for both Win32 and x64.

For x64 you can start with my template and vary it according to your needs.

If the result does not work then please post a sample.

Paul
I used your template for x64 and still get the error message. I use the 9.06 version of the compiler and the /check option.
If I deactivate the /check option, the program works fine.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Aug 08, 2025 3:30 pm    Post subject: Reply with quote

First a correction: You can use the same coding for Win32 and x64 but for x64 the second argument of LABEL@ is not used.

The simple fix for the failure is to make the routine RECURSIVE...

Code:
Module MTest
   integer LAB1
End Module

Program Test_Label
      Use MTest
      Integer a
      Call LABEL@(LAB1,*100)
100   Write(*,*) 'Enter a number: '
      Read(*,*) a
      Call Interface_Sub()
      Write(*,*) 'Next'
      Goto 100
End Program

Recursive Subroutine Interface_Sub()
   Write(*,*) 'within Interface_Sub'
   Call Jump_Sub()
End Subroutine

Subroutine Jump_Sub()
   Use MTest
   Call Jump@(LAB1)
End Subroutine
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 -> 64-bit 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