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

[F2018] do variables in implied-do loop not working correctly

HO
Beginner
1,080 Views

In Fortran 2018 do variables in implied-do loop can have local scope like forall/do concurrent in Fortran 2008, if I understand correctly.   

With ifx (IFORT) 2021.1 Beta 20200827, snippet below doesn't give syntax error, but it doesn't working correctly. The variable x behaves like (implicitly) REAL variable. And if I add implicit none, then compiler gives error.

 HO

snippet

print *, (x, integer(8)::x=1, 10)
end

error message

loop.f90(6): error #6404: This name does not have a type, and must have an explicit type. [X]
print *, (x, integer(8)::x=1, 10)
-----------^

 

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,016 Views

This snippet is not valid Fortran 2018. I understand the confusion because an I/O Implied DO looks a lot like an array constructor or DATA implied DO, but they are treated very differently in the language.

The syntax rule for an I/O implied DO does not permit you to specify the type of the do-variable, which is NOT statement scope nor construct scope (what you call local scope). Any typing is done in the declaration section of the procedure (or BLOCK).  Nothing changed here in F2018.

R1220 io-implied-do-control is do-variable = scalar-int-expr , scalar-int-expr [ , scalar-int-expr ]

There is a bug, and that's that ifort is not rejecting the integer(8):: in this context. Please file a bug report with the Intel Online Service Center.

View solution in original post

0 Kudos
9 Replies
PrasanthD_intel
Moderator
1,066 Views

Hi Haruhiko,


This is a Fortran query and there is a dedicated forum for Fortran compiler(https://community.intel.com/t5/Intel-Fortran-Compiler/bd-p/fortran-compiler). We are transferring your query to that forum.


Regards

Prasanth


0 Kudos
andrew_4619
Honored Contributor II
1,043 Views

I am not sure that all of 2018 is currently implemented, when I last check it was not.

0 Kudos
FortranFan
Honored Contributor II
1,023 Views

@HO ,

Try IFORT driver with your oneAPI BETA installation instead of IFX.

IFX is still under development it appears with features from current Fortran standard (2018).

0 Kudos
Barbara_P_Intel
Moderator
1,003 Views

With oneAPI HPCKit beta09 that was released yesterday, F2018 is fully implemented when using the ifort driver.  That compiler has a new official name, Intel® Fortran Compiler Classic (BETA), too.

The compiler invoked with ifx, Intel® Fortran Compiler (BETA), has limited features at this time.  See the Known Issues section for ifx in the Release Notes.

Remember these are beta releases.

 

0 Kudos
Steve_Lionel
Honored Contributor III
1,017 Views

This snippet is not valid Fortran 2018. I understand the confusion because an I/O Implied DO looks a lot like an array constructor or DATA implied DO, but they are treated very differently in the language.

The syntax rule for an I/O implied DO does not permit you to specify the type of the do-variable, which is NOT statement scope nor construct scope (what you call local scope). Any typing is done in the declaration section of the procedure (or BLOCK).  Nothing changed here in F2018.

R1220 io-implied-do-control is do-variable = scalar-int-expr , scalar-int-expr [ , scalar-int-expr ]

There is a bug, and that's that ifort is not rejecting the integer(8):: in this context. Please file a bug report with the Intel Online Service Center.

0 Kudos
HO
Beginner
950 Views

Thank you Steve and others.

I should have read MFE more carefully. In section 23.8 it is noted "this feature is not available  for an implied-do in an input/output list".    

I tried array constructor but I showed I/O implied-do loop snippet because it was more confusing. In the case of array constructor, the syntax error message looked to me this feature is not yet implemented.    

loop.f90(5): error #6404: This name does not have a type, and must have an explicit type. [I]
m = [(i, integer(8):: i = 1, 10)]
----------------------^

 

I apologize for posting on an inappropriate board.  

HO 

0 Kudos
Steve_Lionel
Honored Contributor III
938 Views

The beta OneAPI compiler accepts this.

0 Kudos
Ron_Green
Moderator
1,001 Views

Bug ID CMPLRLLVM-23026


0 Kudos
Barbara_P_Intel
Moderator
990 Views

Since we're talking Fortran and oneAPI, there is a new Fortran Developer Guide published with oneAPI beta09. 

 

0 Kudos
Reply