- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We have installed the latest ifort version (2021.2.0) hoping to solve our problems with the -check shape option. But the simple program below still gets an error message with -check shape:
PROGRAM test_shape
IMPLICIT NONE
INTEGER, DIMENSION(2) :: array1dim
INTEGER, DIMENSION(2) :: array1dimbis
INTEGER, DIMENSION(3,2) :: array2dim
INTEGER, DIMENSION(4,3,2) :: array3dim
INTEGER:: j,k,l
DO l=1,2
DO k=1,3
DO j=1,4
array3dim(j,k,l)=j+k*10+l*100
ENDDO
ENDDO
ENDDO
array1dim(:)=0.
array1dimbis(:)=0.
array2dim(:,:)=0.
!Fails with -check shape
!error #5581: Shape mismatch: The extent of dimension 1 of array ARRAY1DIM is 2 and the corresponding extent of array ARRAY3DIM is 3
!array1dim(:) = array1dim(:) + SUM(array3dim(1,:,:),1)
!------------------------------^
array1dim(:) = array1dim(:) + SUM(array3dim(1,:,:),1)
write(*,*) 'array1dim(:) =',array1dim
!OK with -check shape. Same result as above without -check shape
array2dim(:,:) = array3dim(1,:,:)
array1dimbis(:) = array1dimbis(:) + SUM(array2dim(:,:),1)
write(*,*) 'array1dimbis(:) =',array1dimbis
!array1dim(:) = 363 663
!array1dimbis(:) = 363 663
END
Let me know what you think: is there really a problem with the compiler, or are we doing something wrong?
Best regards.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There really is a problem with the compiler.
The shape of array3dim(1,:,:) is [3,2]. The shape of SUM(array3dim(1,:,:),1) is [2]. The compiler should not even be testing the shape of array3dim here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the nice reproducer. I filed a bug on your behalf, CMPLRIL0-33973. This one won't be fixed in the compiler that is planned to be released in the next couple of weeks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks Steve for the confirmation and thanks Barbara for filing a bug report.
King regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fix is in review. The fix missed the code cutoff for 2021.4.0, but look for it in 2022.1 later this year. I'll post it here when the fix is available to you.
The compiler engineer points out this workaround. Replace "dim=1" with a variable.
var_dim = 1
array1dim(:) = array1dim(:) + SUM(array3dim(1,:,:),dim=var_dim)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks! We'll wait for the 2022.1 release. Meanwhile I have tested the code modification and it works fine.
Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue you reported when using -check shape is fixed in ifort version 2021.6.0. This compiler version is part of the oneAPI HPC Toolkit 2022.2 that was recently released.

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