Silverfrost Forums

Welcome to our forums

Problem with GO TO (assigned)

26 May 2011 10:47 #8295

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:

      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??

26 May 2011 11:28 #8296

When the error message says you can only ASSIGN to integer (KIND=3), that means to INTEGER* 4!

 INTEGER*4 LABEL1

Eddie

26 May 2011 11:39 #8297

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...

26 May 2011 11:50 #8299

I'm using an older version. Have you tried it with INTEGER*4? All labels must be 32-bit.

Eddie

26 May 2011 12:29 #8302

When I use INTEGER*4 then I get this error:

[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

26 May 2011 12:41 #8303

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.

26 May 2011 12:53 #8304

Thats strang...

Which version of ftn95 do you use??

Do you have some special compilation settings??

I use these:

/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 integer2 and works fine.. /SAVE needs label with integer4 and produces an error..

26 May 2011 1:20 #8305

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

26 May 2011 1:56 #8309

/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.

26 May 2011 7:57 #8310

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

27 May 2011 7:08 #8311

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.

Please login to reply.