Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Syntax error in commented line, strange behaviour

Hello: I am using ifort (IFORT) 16.0.3 20160415 I profusely use the "&" code at the end of a line to be cotinued and at the begining of the next line, which continues the former. And the number of continuing lines can 5 or so. I am also using ifort (IFORT) 17.0.4 20170411 in another machine. In this (17.0) machine I have no problems. But in machine 16.0, the compliler complained about a section of the code where I used the final "&" and the begining "&" in at least 5 consecutive lines. The error said "too confusing statement". So, I joined the 5 lines into 2 ones and compiled. In this compilation I did not get the same error, but another error raised. This time it was a syntax error ... in a commented line!. The offending line was part of a block of several commented lines that I copy and paste here: ! !Code suggested by Dimpsey: ! if(myFirst==0) myFirst=iProb ! MyLast = iProb ! write(*,*) omp_get_thread_num(), omp_in_parallel(), myFirst, myLast The syntax error was detected in the line: ! MyLast = iProb I don't remember the error message (I should have written it down). I thought that the second "!" in the first line could be the cause, although it should not be. I removed it and comiled again. This time the compilatiion took place without any errors. However, the results of the calculation (after the program had run and finished) were incorrect. I compared them whith the results of a run of the program in the other machine with ifort 17.0 and they were different. I could determine without any doubt that the correct results are those of ifort 17.0. So, I think that the compiler (or the prerocessor) is ignoring some "!" and taking a commented line as a non commented one. I have introduced lots of lines in the code with the purpose of tryin some calculations, and afterwards I have commented them. If any of them is uncommented, they can introduce unexpected effects in the calculations. I suspect that the problem with commented lines can be a consequence of my profuse use of "&" at the end of a line to be continued, and susequently at the begining of the next line. Perhaps it messes up the compiler and makes it to make mistakes. So the question is if you have been reported a similar problem and how to fix it. It could be usefuel a compiler option to dump the code as it has understood it.
0 Kudos
1 Reply
Highlighted

Your complaint is related to

Your complaint is related to continuation lines, yet your code example has none.

You also state the problem could potentially involve the preprocessor).

What is the file type you are compiling? And can you supply the complete command line?

I seem to recall an issue relating to FPP (Fortran PreProcessor) with use on very large source files. Can you provide the file sizes that you are compiling.

Jim Dempsey

0 Kudos