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

Data-implied-do rejected for non-trivial subscript expression

Harald1
New Contributor II
636 Views

Hello,

the following code is accepted by NAG but rejected by ifort/ifx:

program p
  integer :: i(4)
  data (i(modulo(j,5)),j=1,4) /4*1/
  print *, i
end

I get:

% ifort ifort-data-implied-do.f90
ifort-data-implied-do.f90(3): error #7829: This expression cannot be evaluated.   [MODULO]
  data (i(modulo(j,5)),j=1,4) /4*1/
----------^
compilation aborted for ifort-data-implied-do.f90 (code 1)

NAG warns in -f2003 mode:

% nagfor ifort-data-implied-do.f90 -f2003
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7101
Extension(F2008): ifort-data-implied-do.f90, line 3: Function reference in DATA-implied-DO
[NAG Fortran Compiler normal termination, 1 warning]

but stays silent with -f2008 or -f2018 and works as expected.

 

Note that a trivial implied do works, such as:

  data (i(j),j=1,4) /4*1/
1 Solution
Barbara_P_Intel
Moderator
549 Views

I filed a bug report on both ifx and ifort for this, CMPLRLLVM-50916.

@Harald1, I'm curious. Did you run into this issue with an application or do you just like to test the bounds of a compiler? Either way, keep them coming! These improve the Intel compiler for other developers.

 

View solution in original post

0 Kudos
6 Replies
jimdempseyatthecove
Honored Contributor III
612 Views

Try using the intrinsic function MOD.

 

Jim Dempsey

0 Kudos
Steve_Lionel
Honored Contributor III
604 Views

@jimdempseyatthecove wrote:

Try using the intrinsic function MOD.

MODULO is also an intrinsic function, subtly different from MOD.

0 Kudos
jimdempseyatthecove
Honored Contributor III
602 Views

>>MODULO is also an intrinsic function, subtly different from MOD.

Yes, but using MOD, might avoid the ICE and attain the desired effect.

 

Jim Dempsey

0 Kudos
Harald1
New Contributor II
584 Views

Well, I also tried MOD and INT, and all are rejected (so rejects-valid, no ICE).

 

Which ifort version are you using?

 

0 Kudos
Barbara_P_Intel
Moderator
550 Views

I filed a bug report on both ifx and ifort for this, CMPLRLLVM-50916.

@Harald1, I'm curious. Did you run into this issue with an application or do you just like to test the bounds of a compiler? Either way, keep them coming! These improve the Intel compiler for other developers.

 

0 Kudos
Harald1
New Contributor II
536 Views

Hi Barbara,

I am performing checks on a few things that sometimes touch more recent Fortran features, and for the (usually more reliable) reference I use Intel and NAG.

 

From time to time there is interesting fallout, which I report here...

 

Reply