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

ifx, coarrays, and evaluation of array indices

Harald1
New Contributor II
2,189 Views

Hello,

the following code gives different results with ifx as compared to NAG:

program p
  implicit none
  integer :: img, data
  integer :: cnt[*] = 0
  integer, allocatable :: res(:)[:]
  allocate(res(num_images())[*], source=-1)
  img = this_image()
  data = 10 * img           ! Something different on each image
  res(get_val())[1] = data
  sync all
  if (this_image() == 1) print *, res
  sync all
  res(this_image())[1] = cnt ! gather count of invocations of get_val
  sync all
  if (this_image() == 1) print *, res
contains
  function get_val()
    integer :: get_val
    get_val = img
    cnt = cnt + 1 ! Count invocations of get_val
  end function
end program

 Compiling it and running with 2 images gives:

% ifx -coarray ifx-coarray-gather.f90 -coarray-num-images=2 && ./a.out
          10          20
           4           4

 OTOH NAG calls get_val only once on each image:

% nagfor -coarray ifx-coarray-gather.f90 && ./a.out 
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7200
[NAG Fortran Compiler normal termination]
 10 20
 1 1

 Is this a bug in ifx?

Best regards,

Harald

 

0 Kudos
2 Replies
Ron_Green
Moderator
1,806 Views

yes, it is a bug.  Nag output is correct.  I think this is related to a previously reported bug in host-associated coarray objects ( cnt in this example ).

 

I will get a separate bug report for this example.  it may be 'same as' the previously reported but it is different enough to warrant a separate investigation. 

0 Kudos
Ron_Green
Moderator
1,499 Views

bug ID is CMPLRLLVM-69390


0 Kudos
Reply