1! { dg-do  run }
2! { dg-additional-options "-fdump-tree-original -ffrontend-optimize" }
3! PR 65819 - this used to cause a temporary in matmul inlining.
4! Check that these are absent by looking for the names of the
5! temporary variables.
6program main
7  implicit none
8  real, dimension(3,3,3) :: f
9  real, dimension(3,3) :: res
10  real, dimension(2,3,3) :: backup
11  integer :: three
12  integer :: i
13
14  data f(1,:,:) /9*-42./
15  data f(2:3,:,:) /2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61/
16  data res /652, 772, 984, 2010, 2406, 3082, 3402, 4086, 5242/
17  three = 3
18  backup = f(2:3,:,:)
19  f(1, 1:three, :) = matmul(f(2,1:3,2:3), f(3,2:3,:))
20  if (any (res /= f(1,:,:))) stop 1
21  if (any (f(2:3,:,:) /= backup)) stop 2
22end program main
23! { dg-final { scan-tree-dump-not "mma" "original" } }
24! { dg-final { scan-tree-dump-not "mmb" "original" } }
25