- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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 MergeModcause the compiler to complain:
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]
[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]
コピーされたリンク
6 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Amusing. I can understand how that happened. I will report it to the developers.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
>>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
Did this produce "IN" or "INOUT"?
Wouldn't intent(in,out)be more syntatically correct (FORTRAN standards may have addressed this issue)
Jim Dempsey
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
This broke between updates 1 and 2 of 12.0 - reported as DPD200166641.