https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101841
Bug ID: 101841 Summary: Wrong realloc-lhs warning with matmul and -O2 Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jellby at yahoo dot com Target Milestone: --- I get a warning with this: program test real, allocatable :: F(:,:), A(:,:), B(:,:) allocate(F(10,10), A(10,10), B(10,10)) F(:,:) = 1.0 A(:,:) = 0.5 B(:,:) = 2.0 F(:,:) = F-matmul(a,b) end program test $ gfortran test.f90 -Wrealloc-lhs -O2 No warning with "F(:,:) = matmul(a,b)" Maybe the warning means that a temporary array is created (although I guess it wouldn't be needed)? But as far as I can see there should be no reallocation here.