- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I am getting a warning #5581: Shape mismatch with the code below. I think it is a false positive but I have been wrong before.
OS: Windows 10
Visual Studio: 2019 Professional 16.4.20
Compiler: IFORT 2021.3.0.306
The reduced test case is
program shape_warning
implicit none
integer, parameter :: L = 8, M = 12, N = 6
real r
real, dimension(2,M,L,L,N) :: a=1.0
r = calc()
write(*,*) r
contains
real function calc result (maxs)
implicit none
real :: s(L,L)
s = sum(a(1,:,:,:,1),dim=1)
maxs = maxval(s)
end
end program shape_warning
With the compiler options
/nologo /debug:full /Od /warn:all /module:"x64\Debug\\" /object:"x64\Debug\\" /Fd"x64\Debug\vc160.pdb" /traceback /check:all /libs:dll /threads /dbglibs /c
I get the warning
Compiling with Intel® Fortran Compiler Classic 2021.3.0 [Intel(R) 64]...
shape_warning.f90
C:\Users\david\source\repos\shape_warning\shape_warning\shape_warning.f90(12): warning #5581: Shape mismatch: The extent of dimension 1 of array S is 8 and the corresponding extent of array A is 12
The code runs correctly, returning r=12.0. If I examine s in the debugger it is an 8x8 array with all values 12.0, as expected. More complicated test cases also behave as expected.
The warning is triggered by the /check:shape compiler option. I am hoping it is just a false warning (or an error on my part) and not a code generation issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Response there is "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. "
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Support request number is 05190993
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Response there is "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. "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Intel support confirmed this is only a diagnostic issue. The generated code is correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I can confirm that the problem above is fixed in ifort version 2021.6.0, which is part of the oneAPI HPC Toolkit 2022.2.
However the following slightly modified example, with a mask for the sum, still generates a warning.
program main
implicit none
integer, parameter :: L = 8, M = 12, N = 6
real r
real, dimension(2,M,L,L,N) :: a=1.0
logical, dimension(M,L,L) :: mask = .true. ! mask
r = calc()
write(*,*) r
contains
real function calc result (maxs)
implicit none
real :: s(L,L)
s = sum(a(1,:,:,:,1),mask=mask,dim=1) !
maxs = maxval(s)
end
end
Compiling with Intel® Fortran Compiler Classic 2021.6.0 [Intel(R) 64]...
calc.f90
C:\Users\david\source\repos\shape_mismatch2\shape_mismatch\calc.f90(13): warning #5581: Shape mismatch: The extent of dimension 2 of array A is 12 and the corresponding extent of array MASK is 8

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