Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Compiler bug?

mecej4
Honored Contributor III
929 Views
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 Kudos
6 Replies
Steven_L_Intel1
Employee
929 Views
Amusing. I can understand how that happened. I will report it to the developers.
0 Kudos
jimdempseyatthecove
Honored Contributor III
929 Views
>>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
0 Kudos
TimP
Honored Contributor III
929 Views
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.
0 Kudos
mecej4
Honored Contributor III
929 Views
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.
0 Kudos
Steven_L_Intel1
Employee
929 Views
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.
0 Kudos
Steven_L_Intel1
Employee
929 Views
This is fixed in Update 4.
0 Kudos
Reply