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

Compiler bug?

mecej4
名誉コントリビューター III
1,615件の閲覧回数
The current Fortran compiler (12.0 Update 2, IA32 and Intel64) accepts the two spellings 'INOUT' and 'IN OUT' as an attribute, but not in an INTENT statement. For example, the following interface declaration, intended to be used with a generic sorting module

[fortran]module MergeMod
Interface
subroutine Merge(QA,NA,QB,NB,QC,NC)
integer, intent(in out) :: NA,NB,NC ! <=== either 'in out' or 'inout' OK
intent(in out) :: QA, QC ! <=== only 'inout' is accepted
intent(in) :: QB
dimension :: QA(NA), QB(NB), QC(NC)
end Subroutine Merge
end Interface
end module MergeMod
[/fortran]
cause the compiler to complain:

[bash]Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.2.154 Build 20110112
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

mint.f90(5): error #5082: Syntax error, found IDENTIFIER 'OUT' when expecting one of: )
intent(in out) :: QA, QC ! <=== only 'inout' is accepted
----------------^
compilation aborted for mint.f90 (code 1)[/bash]
0 件の賞賛
6 返答(返信)
Steven_L_Intel1
従業員
1,615件の閲覧回数
Amusing. I can understand how that happened. I will report it to the developers.
jimdempseyatthecove
名誉コントリビューター III
1,615件の閲覧回数
>>integer,intent(inout)::NA,NB,NC!<===either'inout'or'inout'OK

Did this produce "IN" or "INOUT"?

Wouldn't intent
(in,out)be more syntatically correct (FORTRAN standards may have addressed this issue)

Jim Dempsey
TimP
名誉コントリビューター III
1,615件の閲覧回数
According to this reference f2008 specifically calls out this case as one where INOUT and IN OUT must be interchangeable. I noticed that the current version of the compiler corrected some instances where ENDDO wasn't accepted.
mecej4
名誉コントリビューター III
1,615件の閲覧回数
If it produced 'IN', that would be close to unacceptable and deceptive behavior. By testing the compiler with the following example, we can see that the parsing is done correctly.

[fortran]subroutine Merge(QA,NA,QB,NB,QC,NC)
   integer, intent(in out) :: NA,NB,NC   ! <=== either 'in out' or 'inout' OK
   intent(inout) :: QA, QC             ! <=== only 'inout' is accepted
   intent(in) :: QB
   dimension :: QA(NA), QB(NB), QC(NC)
   NC=NA+NB
   QC(1:NA)=QA
   QC(NA+1:NC)=QB
   return
end Subroutine Merge[/fortran]
The first executable statement would have produced an error at compile time otherwise.
Steven_L_Intel1
従業員
1,615件の閲覧回数
The standard says that the possible INTENT keywords are IN, OUT and INOUT. But a separate part of the standard (under "source form") lists "IN OUT" as an allowed alternative to INOUT.

This broke between updates 1 and 2 of 12.0 - reported as DPD200166641.
Steven_L_Intel1
従業員
1,615件の閲覧回数
This is fixed in Update 4.
返信