Fixes #8573. Fix herk- and syrk_wrapper when matrix has a zero dimension.