Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
27159 Discussions

Problem with -check shape (ifort 2021.2.0)

fmaignan
Beginner
615 Views

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.

 

0 Kudos
6 Replies
Steve_Lionel
Black Belt Retired Employee
585 Views

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.

Barbara_P_Intel
Moderator
528 Views

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.

 

fmaignan
Beginner
520 Views

Hi,

Thanks Steve for the confirmation and thanks Barbara for filing a bug report.

King regards.

Barbara_P_Intel
Moderator
377 Views

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)

 

fmaignan
Beginner
325 Views

Hi,

Thanks! We'll wait for the 2022.1 release. Meanwhile I have tested the code modification and it works fine.

Best regards.

Barbara_P_Intel
Moderator
57 Views

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.



Reply