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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Intel Visual Fortran project: syntax & compiler strange behavior

Status
Not open for further replies.

Sorin Sarateanu

Systems Engineer
Jun 10, 2021
2
RO
I have noticed the below code in one of my Fortran programs:

IF (C.LT.D) THEN
NFAIL(9) = NFAIL(9) + 1
GOTO 152
ENDI F

As it can be seen above the "IF" statement contains a syntax error "ENDI F" instead of "END IF".
To my surprise, when I compile the code, the compiler successfully passes the wrong code and build the program.

How is this possible?



 
It depends on which version of fortran you are coding to. Spaces are allowed in both variable names and keywords in all versions up to and including F77. They are not allowed from f90 onwards. So if your filename ends with .f or .for, then spaces are allowed. Anything else, they aren't allowed.
 
xwb - thank you. I did not realized that until now. Anyway, strange behavior of those Fortran compilers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top