1! { dg-do compile }
2! { dg-options "-Warray-temporaries -O -fdump-tree-original" }
3!
4! PR fortran/43829
5! Scalarization of reductions.
6! Test that product is properly inlined.
7
8! For more extended tests, see inline_sum_1.f90
9
10  implicit none
11
12
13  integer :: i
14
15  integer, parameter :: q = 2
16  integer, parameter :: nx=3, ny=2*q, nz=5
17  integer, parameter, dimension(nx,ny,nz) :: p  = &
18        & reshape ((/ (i, i=1,size(p)) /), shape(p))
19
20
21  integer, dimension(nx,ny,nz) :: a
22  integer, dimension(nx,   nz) :: ay
23
24  a  = p
25
26  ay = product(a,2)
27
28end
29! { dg-final { scan-tree-dump-times "struct array._integer\\(kind=4\\) atmp" 0 "original" } }
30! { dg-final { scan-tree-dump-times "struct array\[^\\n\]*atmp" 0 "original" } }
31! { dg-final { scan-tree-dump-times "_gfortran_product_" 0 "original" } }
32! { dg-final { cleanup-tree-dump "original" } }
33