因此,似乎有一些关于gfortran的行宽限制的问题,但是没有一个关于ifort的问题。编译时出现以下问题:

../../../src/70_gw/gwls_lineqsolver.F90(298): error #5082: Syntax error, found IDENTIFIER 'ENDIF' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; + . - (/ [ : ] /) ' ** / // > ...
&"        endif
----------^
../../../src/70_gw/gwls_lineqsolver.F90(298): error #6404: This name does not have a type, and must have an explicit type.   [ENDIF]
&"        endif
----------^
../../../src/70_gw/gwls_lineqsolver.F90(297): warning #6043: This Hollerith or character constant is too long and cannot be used in the current numeric context.   ['=# of valence states).']
             write(std_out,*) "              subspace (the kernel contains state i=",min_index," > ",nbandv,"=# of valence states).&
------------------------------------------------------------------------------------------------------------^
../../../src/70_gw/gwls_lineqsolver.F90(290): error #6321: An unterminated block exists.
  if (singular .and. ( (project_on_what==1 .and. (min_index > nbandv)) .or. project_on_what==0 ))  then
^
compilation aborted for ../../../src/70_gw/gwls_lineqsolver.F90 (code 1)
make[3]: *** [gwls_lineqsolver.o] Error 1
make[3]: Leaving directory `/home/stud2/7.11.3-private/build/src/70_gw'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/stud2/7.11.3-private/build/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/stud2/7.11.3-private/build'
make: *** [all] Error 2


触发错误的实际代码如下:

if (project_on_what==1 .and. (min_index > nbandv)) then
             write(std_out,*) " "
             write(std_out,*) "              There is a projection on the conduction states, but A is singular in this "
             write(std_out,*) "              subspace (the kernel contains state i=",min_index," > ",nbandv,"=# of valence states)."
end if


我没有gfortran编译器可以对其进行测试,但是我相信由于行长限制,我能做到这一点。是否在ifort中有一个标记来删除此限制?

最佳答案

该错误可能是由于ifort 11.x(Source)中的错误引起的:

从11.x发行版开始,对于以.F90扩展名命名的自由格式源文件,Intel Fortran编译器不会正确忽略-extend-source(和其他变体)。对于以小写.f90扩展名命名的源文件,该选项将被正确忽略。
选项的错误处理将导致任何超出-extend-source选项指定的指定语句字段长度的Fortran源语句的语法错误。

通过将文件扩展名更改为.f90并添加标志-fpp以便维护预处理,可以轻松避免该错误。

关于fortran - ifort线长限制,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26975314/

10-11 22:59