Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29385 Discussions

Compilation error using 11.1.046 & not 10.1.018

samrat_rao
Beginner
982 Views
Hi,
I tried to compile a code that uses both C and F90 languages. But with 11.1.046 i get this error which 10.1.018 does not show:

open(unit=100,file='/media/work/iisc/phd/models/cam_3/cam_3.1/cam_3.1_res/sam_res/detection/sam_changes/trace/full_cam_3.1_trace&
----------------------^
/media/work/iisc/phd/models/cam_3/cam_3.1/cam_3.1_res/sam_res/sam_write/sam_write.F90(41): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ) ,
&.
--^
/media/work/iisc/phd/models/cam_3/cam_3.1/cam_3.1_res/sam_res/sam_write/sam_write.F90(48): error #5082: Syntax error, found IDENTIFIER 'IF' when expecting one of: ( * ) , + . - % . ** / // .LT. < .LE. <= .EQ. == .NE. /= ...
&a if(ios_101/=0) then

The actual line of code is: open(unit=100,file='/media/work/iisc/phd/models/cam_3/cam_3.1/cam_3.1_res/sam_res/detection/sam_changes/trace/full_cam_3.1_trace.txt',status='replace',iostat=ios_100)
if(ios_100/=0) then
call endrun("Cannot replace 'full_cam_3.1_trace.txt'")
endif
rewind 100

Could someone help? Thanks
0 Kudos
8 Replies
Kevin_D_Intel
Employee
982 Views

There's some sort of end-of-line issue in the source likely resulting from editing. The source 'as is' can be cut-n-pasted from this post into a .F90 source file and compiled successfully.

If you edited with vi or vim, you might try this set command, ":set ff=unix", before you ":w" or exit the edit session.

If you are still having trouble, upload the source file to the post and we'll have a look.
0 Kudos
nameiii
Beginner
982 Views
We had a problem on 11.something with large numbers of trailing spaces upsetting the compiler. Often the error referred to a line following the trailing spaces. Deleting the trailing spaces fixed it. I guess this may be related to your issue. Sorry that I can't check the version number - I don't have access to the machine with 11.? today!
0 Kudos
samrat_rao
Beginner
982 Views

There's some sort of end-of-line issue in the source likely resulting from editing. The source 'as is' can be cut-n-pasted from this post into a .F90 source file and compiled successfully.

If you edited with vi or vim, you might try this set command, ":set ff=unix", before you ":w" or exit the edit session.

If you are still having trouble, upload the source file to the post and we'll have a look.
The problem persists, but not if the relevant section is compiled separately. I am attaching the file. The 1st subroutine is the problem. I have used the ":set ff=unix" command even though i am always using a Linux machine. If i exclude this file, the code compiles successfully with the 11.1.046 C and Fortran compilers.

Thanks.
0 Kudos
Kevin_D_Intel
Employee
982 Views

I cannot compile the file as is due to missing .h/.mod files and I too can compile the relevant section stand-alone. Various other things I tried simply won't re-create the same error you showed earlier.

I'm hesitant to ask for the required .mod/.h files fearing there are probably other module dependencies inside those, but if you can isolate this source file and all .mod/.h files needed to reproduce the error and provide us with that, then we can get to the bottom of this.

Alternatively, if you are willing, you might consider breaking the line across multiple continued lines or deleting the line causing the error and re-inserting it from the file that compiles successfully, or re-typing the line completely.

I don't really think it is a line length issue, but another idea is to remove the long path in the FILE specifier and then add in one or two sub-directories at one time to see if there is certain length that triggers the error.

Can youalso post the exact compilation line used for this source file?
0 Kudos
samrat_rao
Beginner
982 Views

I cannot compile the file as is due to missing .h/.mod files and I too can compile the relevant section stand-alone. Various other things I tried simply won't re-create the same error you showed earlier.

I'm hesitant to ask for the required .mod/.h files fearing there are probably other module dependencies inside those, but if you can isolate this source file and all .mod/.h files needed to reproduce the error and provide us with that, then we can get to the bottom of this.

Alternatively, if you are willing, you might consider breaking the line across multiple continued lines or deleting the line causing the error and re-inserting it from the file that compiles successfully, or re-typing the line completely.

I don't really think it is a line length issue, but another idea is to remove the long path in the FILE specifier and then add in one or two sub-directories at one time to see if there is certain length that triggers the error.

Can youalso post the exact compilation line used for this source file?
Hi Kevin,

You are right about the dependencies of the required .mod/.h files. I think that the code is way too big for a logical conclusion about reproducing the error (the executable is 10-15 Mb depending on the architecture). The file i had attached is my addition to one of the top level source files. There is a call to the problem subroutine.

I unsucessfully tried retyping the line. Right now it seems to be a line length issue and the problem arises after about 75-80 characters. Not sure if the same line length would persist if the routine is called from elsewhere.

Is it a bug?

Thanks.
0 Kudos
Kevin_D_Intel
Employee
982 Views

I found the smoking gun. You (or the makefile) must specifying a compiler option like: -extend-source 132

Here's the same error you suffered:

$ ifort -c -V sam_prune.F90 -extend-source 132
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090630 Package ID: l_cprof_p_11.1.046
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Intel Fortran 11.1-2536
sam_prune.F90(22): error #5120: Unterminated character constant
open(unit=100,file='/media/work/iisc/phd/models/cam_3/cam_3.1/cam_3.1_res/sam_res/detection/sam_changes/trace/full_cam_3.1_trace&
----------------------^
sam_prune.F90(23): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ) ,
&.
--^
sam_prune.F90(30): error #5082: Syntax error, found IDENTIFIER 'IF' when expecting one of: ( * ) , + . - % . ** / // .LT. < .LE. <= .EQ. == .NE. /= ...
&a if(ios_101/=0) then
-----^
sam_prune.F90(30): error #5082: Syntax error, found IDENTIFIER 'THEN' when expecting one of: ( * ) :: , ; + . - % (/ [ : ] /) . ' ** / ...
&a if(ios_101/=0) then
--------------------^
sam_prune.F90(32): error #6317: An ENDIF occurred without a corresponding IF THEN or ELSE statement.
endif
---^
compilation aborted for sam_prune.F90 (code 1)


Check if that option is present and if so do notuse it for this particular source file because the option limits the statement field to 132 characters. As the line appears now, the 132nd character appears just after the "trace" in the file name. Your only other option is to significantly reduce the path to the file specified.

The file will compile as is with the long line if you do not use:-extend-source 132
0 Kudos
samrat_rao
Beginner
982 Views

I found the smoking gun. You (or the makefile) must specifying a compiler option like: -extend-source 132

Here's the same error you suffered:

$ ifort -c -V sam_prune.F90 -extend-source 132
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090630 Package ID: l_cprof_p_11.1.046
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Intel Fortran 11.1-2536
sam_prune.F90(22): error #5120: Unterminated character constant
open(unit=100,file='/media/work/iisc/phd/models/cam_3/cam_3.1/cam_3.1_res/sam_res/detection/sam_changes/trace/full_cam_3.1_trace&
----------------------^
sam_prune.F90(23): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ) ,
&.
--^
sam_prune.F90(30): error #5082: Syntax error, found IDENTIFIER 'IF' when expecting one of: ( * ) , + . - % . ** / // .LT. < .LE. <= .EQ. == .NE. /= ...
&a if(ios_101/=0) then
-----^
sam_prune.F90(30): error #5082: Syntax error, found IDENTIFIER 'THEN' when expecting one of: ( * ) :: , ; + . - % (/ [ : ] /) . ' ** / ...
&a if(ios_101/=0) then
--------------------^
sam_prune.F90(32): error #6317: An ENDIF occurred without a corresponding IF THEN or ELSE statement.
endif
---^
compilation aborted for sam_prune.F90 (code 1)


Check if that option is present and if so do notuse it for this particular source file because the option limits the statement field to 132 characters. As the line appears now, the 132nd character appears just after the "trace" in the file name. Your only other option is to significantly reduce the path to the file specified.

The file will compile as is with the long line if you do not use:-extend-source 132

Thanks Kevin, you were right. I found this option in the makefile '-132' (not -extend-source 132). I think that this option is recognized by version 10.1.018 and not by 11.1.046. Removing that solved the error. But i do not know why version 11.1.046 does not ignore the option.
0 Kudos
Kevin_D_Intel
Employee
982 Views

Therein lies the bug. -extend-source (and variants) are supposed to only apply to fixed-form source files.

Beginning with our 11.x release, the compiler stop recognizing the .F90 extension as a free-form source file in relation to this option, thus it enforces the affects of the option resulting in the errors.

Another work-around to dropping the -132 (or variant) is to rename the file to use .f90 (lower-case) and add -fpp.

I reported this issue to the developers and will keep the thread updated as I learn more.

(Internal tracking id: DPD200138566)

(Resolution Update on 9/18/2009): This defect is fixed in the Intel Fortran Compiler Professional Edition 11.1 update, 11.1.056 (Linux).
0 Kudos
Reply