https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80975
Bug ID: 80975 Summary: [7 Regression] matmul for zero-length arrays Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: Melven.Roehrig-Zoellner at DLR dot de Target Milestone: --- Hi, the following code fails in GCC 7.1 (at least for my setup): program bogus_matmul implicit none real :: M(3,0), v(0), w(3) w = 7 w = matmul(M,v) if( any(w .ne. 0) ) then call exit(1) end if end program vast_chk_bogus_matmul The correct result for w should be zero (at least "mathematically", I didn't check the standard!) However, with GCC 7.1 it is not zero. Works fine in 6.2 and any other previous version I used before. I'm using mingw-w64: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.1.0/threads-posix/seh/ And I used the following compile flags: -std=f2008 -ffree-line-length-none -fall-intrinsics -fno-realloc-lhs -fdefault-real-8 -fdefault-double-8 -finit-real=snan -g -O0 -Wall -Wimplicit-interface -fcheck=all -fbacktrace -Wno-unused-dummy-argument -Wno-surprising -Wno-unused-variable -fopenmp Unfortunately I cannot easily check if it also fails on Linux!