1! { dg-do run }
2! Check the fix for PR28947, in which the mechanism for dealing
3! with matmul (a, transpose (b)) would cause wrong results for
4! a having a rank == 1.
5!
6! Contributed by Harald Anlauf  <anlauf@gmx.de>
7!
8program gfcbug40
9  implicit none
10
11  real :: h(3,3), mat(2,3)
12
13  h(:,:) = - HUGE (1.0)/4       ! Preset unused elements suitably...
14
15  h(3,:) = 0
16  h(3,3) = 1
17  mat(:,:) = 1
18  h(3,:) = h(3,:) + matmul (matmul (h(3,:), transpose (mat)), mat)
19
20  if (any (h(3,:) .ne. (/2.0, 2.0, 3.0/))) STOP 1
21
22end program gfcbug40
23