http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22572
--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-04-22 15:57:01 UTC --- We should generate function optmatmul (a, b, c, m, n, count) implicit none integer, intent(in) :: m, n, count double precision :: optmatmul(m, n) double precision, intent(in) :: a(m, count), b(count, n), c(m, n) block double precision, dimension(size(a,1), size(b,2)) :: tmp tmp = matmul(a,b) optmatmul = tmp / (1 + tmp) end block end function optmatmul I forsee lots of special-casing here...