Community
cancel
Showing results for 
Search instead for 
Did you mean: 
HO
Beginner
380 Views

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

Jump to solution

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
Black Belt Retired Employee
316 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

9 Replies
PrasanthD_intel
Moderator
366 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


andrew_4619
Valued Contributor III
343 Views

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

FortranFan
Honored Contributor I
323 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).

Barbara_P_Intel
Moderator
303 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.

 

Steve_Lionel
Black Belt Retired Employee
317 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

HO
Beginner
250 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 

Steve_Lionel
Black Belt Retired Employee
238 Views

The beta OneAPI compiler accepts this.

Ronald_G_Intel
Moderator
301 Views

Bug ID CMPLRLLVM-23026


Barbara_P_Intel
Moderator
290 Views

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

 

Reply