View previous topic :: View next topic |
Author |
Message |
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Thu May 26, 2011 11:47 am Post subject: Problem with GO TO (assigned) |
|
|
I know that the assigned GO TO statement has been deleted in Fortran 95 but we try to port your Fortran 77 programs to Fortran 95 now.
You write that the feature is not deleted from ftn95, so I can compile and link my program but I get an access violation at this point when I run it!
My simple program:
Code: |
PROGRAM LTEST
C
INTEGER*2 LABEL1
C
ASSIGN 50 TO LABEL1
GOTO LABEL1
C
50 CONTINUE
C
END
|
Is there a hack how I can use the goto assigned label without an access violation?? |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Thu May 26, 2011 12:28 pm Post subject: |
|
|
When the error message says you can only ASSIGN to integer (KIND=3), that means to INTEGER* 4!
INTEGER*4 LABEL1
Eddie |
|
Back to top |
|
 |
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Thu May 26, 2011 12:39 pm Post subject: |
|
|
there are no errors while compiling
ftn95 test.for /debug
[FTN95/Win32 Ver. 6.10.0 Copyright (c) Silverfrost Ltd 1993-2011]
NO ERRORS [<LTEST> FTN95/Win32 v6.10.0]
When I execute the program I get the error:
---------------------------------------------------
Access Violation
main - in file test.for at line 6 [+0021]
---------------------------------------------------
line 6 is the "ASSIGN 50 TO LABEL1 " statement... |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Thu May 26, 2011 12:50 pm Post subject: |
|
|
I'm using an older version. Have you tried it with INTEGER*4? All labels must be 32-bit.
Eddie |
|
Back to top |
|
 |
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Thu May 26, 2011 1:29 pm Post subject: |
|
|
When I use INTEGER*4 then I get this error:
Quote: | [FTN95/Win32 Ver. 6.10.0 Copyright (c) Silverfrost Ltd 1993-2011]
0006) ASSIGN 50 TO LABEL1
*** Only INTEGER(KIND=2) variables may be ASSIGNed to
1 ERROR [<LTEST> FTN95/Win32 v6.10.0]
*** Compilation failed |
|
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Thu May 26, 2011 1:41 pm Post subject: |
|
|
Your code works for me if I use INTEGER*4 or INTEGER(Kind=3) or INTEGER. All of these are same 32 bit integer type. |
|
Back to top |
|
 |
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Thu May 26, 2011 1:53 pm Post subject: |
|
|
Thats strang...
Which version of ftn95 do you use??
Do you have some special compilation settings??
I use these:
Quote: | /ALL_WARNINGS
/ALT_KINDS
/FIXED_FORMAT
/INTS
/LOGS
/OLD_ARRAYS
/PERSIST
/SAVE
/SINGLE_THREADED
/UNLIMITED_ERRORS
/WINDOWS
/ZEROISE |
Edit:
I have removed all my settings in the config and I get no violation now..
I check which option produces this strange behavior
Edit2:
/INTS needs label with integer*2 and works fine..
/SAVE needs label with integer*4 and produces an error.. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Thu May 26, 2011 2:20 pm Post subject: |
|
|
I use 4.90 (Academic licence). For some bizarre and unfathomable reason that I do not understand, this machine (at my University) appears to be licensed for 5.20.1, but nevertheless it has my name on it !
I only use the Win32 / Clearwin options, and as far as I know, don't have anything set as standard in a config file.
/SINGLE_THREADED looks to be a hangover from the DBOS version of FTN77 - is it still valid?
Eddie |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu May 26, 2011 2:56 pm Post subject: |
|
|
/ALT_KINDS will mess things up for you.
You need INTEGER(kind = 4) when using /ALT_KINDS.
That is, the kind values are 1, 2, 4 and 8 when you use ALT_KINDS. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Thu May 26, 2011 8:57 pm Post subject: |
|
|
Paul,
ALT_KINDS will upset the apple cart if you use KIND. It shouldn't for INTEGER*2, surely?
What puzzles me is that he doesn't get an error message. There is a very clear message with my licensed version, and also PE version 6.10.
Eddie |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Fri May 27, 2011 8:08 am Post subject: |
|
|
With the current version of FTN95 you should be able to use
INTEGER if the default KIND has not been changed
INTEGER*4
INTEGER(KIND=3) if the default KIND values have not been changed
INTEGER(KIND=4) if /ALT_KINDS has been used
Anything else should produce a compile time error. |
|
Back to top |
|
 |
|