- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using compiler version 11.1.060 [IA-32] and have some trouble with include-files and the compiler switch warn:interfaces. I get following error message:
c:...checkit.f(5): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % : . = =>
c:...checkit.f(5): error #6218: This statement is positioned incorrectly and/or has syntax errors.
compilation aborted for c:...checkit.f (code 1)
Here my source-code:
checkit.f:
SUBROUTINE CHECK
INCLUDE 'checkit.fd'
C
CHARACTER*60 CTEXTL
C
CALL TEXTDA(1,CTEXTL)
END
chedit.fd contains:
!MS$FREEFORM
! Microsoft Developer Studio generated include file.
! Used by check_deu.rc
!
integer, parameter :: TEST =1
The module for textda in the directory ./module contains
!COMPILER-GENERATED INTERFACE MODULE: Tue Dec 22 16:02:23 2009
MODULE TEXTDA__genmod
INTERFACE
SUBROUTINE TEXTDA(ISCHAL,CWERT)
INTEGER(KIND=4) :: ISCHAL
CHARACTER(*) :: CWERT
END SUBROUTINE TEXTDA
END INTERFACE
END MODULE TEXTDA__genmod
My command-line:
/nologo /debug:full /Od /DDEBUG /gen-interfaces /debug-parameters:all /warn:declarations /warn:unused /warn:truncated_source /warn:interfaces /Qauto_scalar /align:commons /assume:byterecl /Qfp-stack-check /iface:cvf /module:".\\modules" /object:".\\Debug/" /traceback /check:pointer /check:bounds /check:uninit /check:format /check:output_conversion /check:arg_temp_created /libs:static /threads /dbglibs /c
The error-message disappers when I remove the switch warn:interfaces or when I remove the line
!MS$FREEFORM in checkit.fd. This seems to be a compiler problem.
c:...checkit.f(5): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % : . = =>
c:...checkit.f(5): error #6218: This statement is positioned incorrectly and/or has syntax errors.
compilation aborted for c:...checkit.f (code 1)
Here my source-code:
checkit.f:
SUBROUTINE CHECK
INCLUDE 'checkit.fd'
C
CHARACTER*60 CTEXTL
C
CALL TEXTDA(1,CTEXTL)
END
chedit.fd contains:
!MS$FREEFORM
! Microsoft Developer Studio generated include file.
! Used by check_deu.rc
!
integer, parameter :: TEST =1
The module for textda in the directory ./module contains
!COMPILER-GENERATED INTERFACE MODULE: Tue Dec 22 16:02:23 2009
MODULE TEXTDA__genmod
INTERFACE
SUBROUTINE TEXTDA(ISCHAL,CWERT)
INTEGER(KIND=4) :: ISCHAL
CHARACTER(*) :: CWERT
END SUBROUTINE TEXTDA
END INTERFACE
END MODULE TEXTDA__genmod
My command-line:
/nologo /debug:full /Od /DDEBUG /gen-interfaces /debug-parameters:all /warn:declarations /warn:unused /warn:truncated_source /warn:interfaces /Qauto_scalar /align:commons /assume:byterecl /Qfp-stack-check /iface:cvf /module:".\\modules" /object:".\\Debug/" /traceback /check:pointer /check:bounds /check:uninit /check:format /check:output_conversion /check:arg_temp_created /libs:static /threads /dbglibs /c
The error-message disappers when I remove the switch warn:interfaces or when I remove the line
!MS$FREEFORM in checkit.fd. This seems to be a compiler problem.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your use of '!' in column 1 indicates free-form lines starting in column 1, whereas your
subroutine CHECK code has 'C' in column 1, I presume indicating a comment, even though your CHARACTER and CALL also appear to start in column 1. So if the compiler is reading that part as free form. it is objecting to the 'C' in column 1 I suspect.
Your 'CHECK' code also contains no USE or specification statements. Have you purposely omitted them from this post? Have leading blanks been truncated from posted code, giving the appearance of starting in columnn 1?
subroutine CHECK code has 'C' in column 1, I presume indicating a comment, even though your CHARACTER and CALL also appear to start in column 1. So if the compiler is reading that part as free form. it is objecting to the 'C' in column 1 I suspect.
Your 'CHECK' code also contains no USE or specification statements. Have you purposely omitted them from this post? Have leading blanks been truncated from posted code, giving the appearance of starting in columnn 1?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I didn't realize that leading blanks have been erased. Here my code once again with leading blanks:
checkit.f: (fixed form: C in column 1, all other lines begin in column 7)
checkit.fd (freeform: ! in column 1, all other lines begin in column 7) This include file was generated by deftofd.exe which converts a c include file (e.g. resource.h) to an fd-file.
checkit.f: (fixed form: C in column 1, all other lines begin in column 7)
[fxfortran] SUBROUTINE CHECK INCLUDE 'checkit.fd' C CHARACTER*60 CTEXTL C CALL TEXTDA(1,CTEXTL) END [/fxfortran]
checkit.fd (freeform: ! in column 1, all other lines begin in column 7) This include file was generated by deftofd.exe which converts a c include file (e.g. resource.h) to an fd-file.
[fortran]!MS$FREEFORM ! Microsoft Developer Studio generated include file. ! Used by check_deu.rc ! integer, parameter :: TEST =1 [/fortran]textda__genmod.f90 (all lines begin in column 9! Select 'view plain' to see the blanks) This file was automatically generated with compiler switch /gen-interfaces)
[fortran] !COMPILER-GENERATED INTERFACE MODULE: Tue Dec 22 16:02:23 2009 MODULE TEXTDA__genmod INTERFACE SUBROUTINE TEXTDA(ISCHAL,CWERT) INTEGER(KIND=4) :: ISCHAL CHARACTER(*) :: CWERT END SUBROUTINE TEXTDA END INTERFACE END MODULE TEXTDA__genmod [/fortran]So everything I wrote myself was the fixed form source file checkit.f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your include file includes !MS$FREEFORM - an announcement that what follows will be free form Fortran. Then your own code is written using fixed format.
Change your own code to use free format, and all should be well.
Or remove the FREEFORM command and ensure that the Microsoft-generated code is valid when interpreted as fixed format.
Compilers may still assume that file suffixes for .for/.f will be fixed format - a possible extension change may be needed if you switch to free format.
Change your own code to use free format, and all should be well.
Or remove the FREEFORM command and ensure that the Microsoft-generated code is valid when interpreted as fixed format.
Compilers may still assume that file suffixes for .for/.f will be fixed format - a possible extension change may be needed if you switch to free format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Removing !MS$FREEFORM works. That's right. But itworks too if I don't remove !MS$FREEFORM because this flag applies only to the include file! Mixing free-form and fixed-form in this way is allowed.
You can proof it by simply removing the call of TEXTDA, or disabeling /warn-interfaces.
The problem is that /warn-interfaces changes the behaviour of the compiler how include-files are handled. I think it's simply a compiler bug.
You can proof it by simply removing the call of TEXTDA, or disabeling /warn-interfaces.
The problem is that /warn-interfaces changes the behaviour of the compiler how include-files are handled. I think it's simply a compiler bug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it's a bug. Escalated as issue DPD200153474. Thanks for bringing it to our attention.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was fixed in 12.0.

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