Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a Fortran 77 or newer compiler fo PC 1

Status
Not open for further replies.

ksqr

Systems Engineer
Jul 11, 2022
13
0
0
US
Hi I'm new here and hope this isn't a question beaten to death. I'm thinking about getting back into Fortran and would like to find a compiler that works on Windows 64 bit. By compiler, I mean something that compiles the source, generates binaries and then an executable. I would prefer something that does all of that without having to pass code to a C compiler or using Microsoft Visual Studio, etc. Of a course high level debugger would be important. Oh, and free (or cheap) would be great. Years ago I did lots of programming in Fortran IV, Data General Fortran 5, Fortran 77 and Lahey Fortran 77. I'd kinda like to revisit a language I really enjoyed. A major project I did was a program for data entry and graphic display of property parcel info for a large county in Arizona. Still have the source. Maybe I can get it to work again.[smile] Another language I had fun with was Algol (Data General DG/L) but we won't go there now.
 
For the gfortran compiler the source file extension is important.
All type of comments (c, *, !) work with the file extension *[highlight #FCE94F].f[/highlight] and *[highlight #FCE94F].for[/highlight].
@ksqr: what source file extension are you using ?

 
I'm using .for for a source file extension.
The error message I get is:
COMPASS.IN:12:20:

12 | DATA DRA/Z'5F'/ ! Down right angle
| 1
Error: BOZ literal constant near (1) cannot be assigned to a 'CHARACTER(1)' variable
COMPASS.IN:11:20:

11 | DATA DLA/Z'5E'/ ! Down left angle
| 1
Error: BOZ literal constant near (1) cannot be assigned to a 'CHARACTER(1)' variable

Source is:
SUBROUTINE GSIDINDX (WORK_BUFF, IP)

C Subroutine to get index of sides string delimiter.

C Called from: DEFAPNTS
C DEFLPNTS
C OFSTDISP

INTEGER*2 IP
CHARACTER*(*) WORK_BUFF
CHARACTER*1 TEMP
LOGICAL GOT_IT

INCLUDE 'COMPASS.IN'

C Determine index of next delimiter...

IP = 1 ! Initialize
GOT_IT = .FALSE.

10 TEMP = WORK_BUFF(IP:IP) ! Get character

IF (TEMP .GE. UP) THEN
IF (TEMP .LE. DOWN) THEN
GOT_IT = .TRUE.
END IF
END IF

IF (TEMP .GE. ULA) THEN
IF (TEMP .LE. DRA) THEN
GOT_IT = .TRUE.
END IF
END IF

IF (GOT_IT) THEN
GO TO 99
ELSE
IP = IP + 1 ! Bump index pointer
GO TO 10
END IF

99 RETURN

END
 
Sorry - COMPASS.IN contains:
CHARACTER*1 UP, DOWN, LLEFT, RRIGHT
CHARACTER*1 ULA, URA, DLA, DRA, ESCAPE

DATA ESCAPE/Z'1B'/
DATA UP/Z'17'/
DATA DOWN/Z'1A'/
DATA LLEFT/Z'19'/
DATA RRIGHT/Z'18'/
DATA ULA/Z'5C'/ ! Up left angle
DATA URA/Z'5D'/ ! Up right angle
DATA DLA/Z'5E'/ ! Down left angle
DATA DRA/Z'5F'/ ! Down right angle
 
ksqr said:
I'm using .for for a source file extension.
The error message I get is:
COMPASS.IN:12:20:
Then try to rename compass.in to compass.for
and in other sources instead of using
INCLUDE 'COMPASS.IN'
use rather
INCLUDE 'COMPASS.FOR'
 
Nope. Rename didn't help. I found that the error is due to the data assignment, not the ! comment.

CHARACTER*1 ULA, URA, DLA, DRA, ESCAPE
DATA ESCAPE/Z'1B'/

The above is supposed to assign the hex value for Escape which is 1B (or 33 octal or 27 decimal) to the variable ESCAPE.
Instead I get:
Error: BOZ literal constant near (1) cannot be assigned to a 'CHARACTER(1)' variable

Must need another switch[dazed]
 
Nope. Distilled to simple program:
PROGRAM FOO
CHARACTER*1 ESCAPE
DATA ESCAPE/Z'1B'/
END​

Compile with:
gfortran -c -g -S -ffixed-line-length-none -fno-align-commons -fallow-invalid-boz -std=legacy

Still get:
Error: BOZ literal constant cannot be assigned to a 'CHARACTER(1)' variable
 
Well it looks like only integer variables are allowed in DATA statements. I guess maybe what I had was an extension to the F77 standard? Oh well I can work around it. An it's probably time to let this topic expire. Thanks very much for the help offered here! [smile]
 
This problem can be fixed with a parameter statement but it is a bit long winded

Code:
      PROGRAM FOO
      CHARACTER*1 ESCCH
      PARAMETER (ESCCH = CHAR(Z'1B'))
      CHARACTER*1 ESCAPE /ESCCH/
      END

Unless you are going to change ESCAPE, you may as well just use the parameter statement

Code:
      PROGRAM FOO
      CHARACTER*1 ESCAPE
      PARAMETER (ESCAPE = CHAR(Z'1B'))
      END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top