- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This is talked at here Trying to rebuild application with .bat files - Intel Community
To make it simple, I made this small program:
!e5082.for
INTEGER STOPPOINT
DIMENSION STOPPOINT(:,:,:)
ALLOCATABLE :: STOPPOINT
integer ALLOERR
integer I
ALLOCATE (STOPPOINT(1:4,1:3,0:5),STAT=ALLOERR)
I=1
STOPPOINT(1:4,1:3,0:I)=0
end
Compile it gives an error:
D:\r>ifort -c e5082.for
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Build 20201112_000000
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
e5082.for(8): error #5082: Syntax error, found '=' when expecting one of: :: ) , : * <END-OF-STATEMENT> ; . % (/ + - ] /) . ' ** / // > ...
STOPPOINT(1:4,1:3,0:I)=0
----------------------------^
e5082.for(8): error #6911: The syntax of this substring is invalid. [POINT]
STOPPOINT(1:4,1:3,0:I)=0
----------^
compilation aborted for e5082.for (code 1)
But if I change the variable name from StopPoint to STONT, the compiler then has no complaint.
INTEGER STONT
DIMENSION STONT(:,:,:)
ALLOCATABLE :: STONT
integer ALLOERR
integer I
ALLOCATE (STONT(1:4,1:3,0:5),STAT=ALLOERR)
I=1
STONT(1:4,1:3,0:I)=0
end
The problem seems that you can not use STOP to start a variable name. STOPa has the same error.
Cheers,
Cean
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
STOP is a statement so the compiler complains from POINT
Syntax of STOP statement
STOP [string]
In Fortran there is no reserved word but the syntax implies the meaning so a line beginning by STOP is a STOP statement.
Another exemple
DO I=1.2
is legal (affecting 1.2 to DOI variable because spaces are ignored)
DO I=1,2
is a loop statement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not agree that this is a fixed vs. free form issue. Indeed, I wrote about this topic in Doctor Fortran in "No Reserve" - Doctor Fortran (stevelionel.com)
The compiler has ways of disambiguating statements that start with a statement keyword but aren't those statements. In this case, the appearance of the equal sign or parenthesis is a clue that this is NOT a STOP statement. (I spent a lot of time in the VAX FORTRAN statement classifier code.)
My guess is that when Intel implemented the Fortran 2018 enhancements to STOP to add the optional ", QUIET=expression", the programmer was not careful enough. This is a compiler bug.
That said, fixed form should be avoided on general principles in new code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To be clear the error only occurs in fixed form is compiles OK in freeform. It seems the Fortran parser is getting confused.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To emphasize: This is the case with fixed form! In fixed form spaces (except in strings) are irrelevant. So, as GVautier indicates, the compiler recognizes the word STOPPOINT as a statement "STOP POINT".
One solution: use free form

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page