- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This small example exposes an error with the executable code for a MATMUL reference when one of its actual arguments is a multirank coindexed object. The example compares the result of that MATMUL with the value computed by first assigning the coindexed object to a local array and passing it instead. The error occurs for both ifort 2021.9 and ifx 2023.1
Judging from the output, I suspect that in the first case MATMUL is being handed the transpose
of the matrix by mistake (e.g., by mistaking the column-major data for row-major)
$ ifort -coarray -coarray-num-images=2 bug.f90
$ ./a.out
error on image 1
c1= 2.000000 4.000000 6.000000 8.000000
c2= 4.000000 2.000000 8.000000 6.000000
real :: a(2,2), b(2,2)[*], c1(2,2), c2(2,2), tmp(2,2)
a = reshape([0,1,1,0], shape=[2,2])
b = this_image()*reshape([1,2,3,4], shape=[2,2])
sync all
if (this_image() < num_images()) then
c1 = matmul(a, b(:,:)[this_image()+1]) ! EXCHANGES ROWS OF B
tmp = b(:,:)[this_image()+1]
c2 = matmul(a, tmp)
if (any(c1 /= c2)) then
print *, 'error on image', this_image()
print *, 'c1=', c1
print *, 'c2=', c2
error stop
end if
end if
end
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@NCarlson wrote:[...]
Judging from the output, I suspect that in the first case MATMUL is being handed the transpose
of the matrix by mistake (e.g., by mistaking the column-major data for row-major)
Scratch that. I have no idea what it's doing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I forgot to add that this error seems to be specific to the MATMUL intrinsic. If that function is replaced by a user-written function, its dummy array receives the correct matrix from the coindexed actual argument.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to confirm, what is the expected output? I suspect there should be no output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
C2 is the correct result, but yes, there should be no output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's so great when you guys supply simple reproducers!
I filed a bug on this, CMPLRLLVM-48376. I'll let you know when I know more.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@NCarlson, I just compiled and ran your reproducer with the versions of ifx and ifort that were released this week. I have NO output!
Please check out these new versions!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page