 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
simon
Joined: 05 Jul 2006 Posts: 295
|
Posted: Fri Mar 28, 2025 7:47 am Post subject: Runtime error in 64-bit but not 32 |
|
|
I have been getting runtime errors when running a program in 64-bit. The following example has taken me about 40 hours to reduce to something that will hopefully be manageable. I believe that the modules and the program may need to be in separate files, so I am displaying them individually.
Code: | Module m1
Type, Public :: t1_t
Integer :: iyr
End Type t1_t
Character, Public :: c
Type(t1_t), Public :: at1
End Module m1 |
Code: | Module m2
Implicit None
!
Contains
!
Subroutine s1 ( )
Use m1, Only: c, at1
Character :: c2
Logical :: l
l = .false.
Call s2 ( l, at1, c, c2 )
Return
End Subroutine s1
!
Subroutine s2 ( l, at1, c, c2 )
Use m1, Only: t1_t
Logical, Intent(In) :: l
Type(t1_t), Intent(InOut) :: at1
Character(Len=*), Intent(Out) :: c, c2
Integer :: ifail
c = 'C'
Call s21 ( 1, l, ifail, c, c2 )
ifail = 0
Return
!
Contains
!
Subroutine s21 ( kl, l, ifail, c, c2 )
Integer, Intent(In) :: kl
Logical, Intent(In) :: l
Integer, Intent(Out) :: ifail
Character(Len=*), Intent(Out) :: c, c2
Character(Len=4) :: ctag
c2 = ' '
ctag = 'ABC'
Call s3 ( ctag//' ', [ 'a' ] )
c = 'F'
If ( .not.l ) Then
Continue
End If
Return
End Subroutine s21
End Subroutine s2
!
Subroutine s3 ( c, cs )
Character(Len=*), Intent(In) :: c
Character(Len=*), Dimension(:), Intent(In) :: cs
Return
!
Contains
!
Subroutine s31 ( j )
Integer, Intent(Out) :: j
j = 1
Return
End Subroutine s31
End Subroutine s3
End Module m2 |
Code: | Program cpt
Use m2, Only: s1
Call s1 ( )
End Program cpt |
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8167 Location: Salford, UK
|
Posted: Fri Mar 28, 2025 9:26 am Post subject: |
|
|
Simon
This code runs without failure for me and I have used separate files and tried various FTN95 build options (/CHECK etc.).
Which version of FTN95 are you using?
Admittedly there is a lot that could go wrong particularly the use of a CONTAINed subroutine within a module subroutine.
Fortran is not a well-structured language and you can only push it so far. |
|
Back to top |
|
 |
simon
Joined: 05 Jul 2006 Posts: 295
|
Posted: Fri Mar 28, 2025 3:59 pm Post subject: |
|
|
Hi Paul,
Hmm, that's curious. I get a crash with the following settings:
/DEBUG /DEFINT_KIND 3
without /DEBUG. The error message I get using /DEBUG is shown below. The last mentioned line, namely line 38, is:
I am using version 9.10.2.0, but I get the same error with 9.10.0.0. I do not get the error with 9.00.0.
Quote: | Silverfrost 64-bit exception report on C:\Users\Simon\Documents\cpt\src\batch_sf64\CPT64_batch.exe Fri Mar 13 18:26:12 1970
Access violation (c0000005) at address 7ffd67401899
Within file VCRUNTIME140.dll
In memmove at address 699
In CCOPY$ at address D4
Within file CLEARWIN64.DLL
Within file CPT64_batch.exe
in M2!S2~S21 in line 38, at address 15f
in M2!S2 in line 22, at address b9
in M2!S1 in line 11, at address 59
in CPT in line 3, at address 16
RAX = 0000000000000020 RBX = 0000000000000001 RCX = 0000009663794852 RDX = 0000000000000020
RBP = 00000000004060e8 RSI = 0000009663795751 RDI = 0000000000407000 RSP = 000000000240fc30
R8 = 0000009663795751 R9 = 0000000000406101 R10 = 00007ffd673f0000 R11 = 2020202020202020
R12 = 0000000000000000 R13 = 0000000000000002 R14 = 0000000000406100 R15 = 0000009663795752
7ffd67401899) rep_stos_b | [/code] |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8167 Location: Salford, UK
|
Posted: Fri Mar 28, 2025 4:28 pm Post subject: |
|
|
The failure is within ClearWin64.dll so make sure that you are accessing a the DLL that is released with the version of FTN95 that you are using. |
|
Back to top |
|
 |
simon
Joined: 05 Jul 2006 Posts: 295
|
Posted: Sun Mar 30, 2025 7:20 am Post subject: |
|
|
I have removed all routines that were contained within other routines inside a module, and that seems to have successfully resolved some previous failings. Many thanks for the suggestion. |
|
Back to top |
|
 |
simon
Joined: 05 Jul 2006 Posts: 295
|
Posted: Mon Mar 31, 2025 3:55 pm Post subject: |
|
|
... but why was there a conflict with ClearWin+ when no ClearWin+ routines were being used? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8167 Location: Salford, UK
|
Posted: Mon Mar 31, 2025 5:16 pm Post subject: |
|
|
ClearWin64.dll contains almost all of the FTN95 library functions in addition to the whole of the ClearWin+ library.
For Win32, everything is in salflibc.dll but for x64, the startup code and exception handling is in saflibc64.dll but almost everything else for Fortran is in ClearWin64.dll.
In that sense the name of the DLL is not very helpful. |
|
Back to top |
|
 |
simon
Joined: 05 Jul 2006 Posts: 295
|
Posted: Mon Mar 31, 2025 5:56 pm Post subject: |
|
|
Ok. That makes sense. |
|
Back to top |
|
 |
|
|
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
|