summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/array_constructor_47.f90
blob: 19ec8c8fd8fc2a1576293dcf070f63601cada76f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
! { dg-do run }
! { dg-options "-ffrontend-optimize -fdump-tree-original" }
! Test that reduction optimization doesn't break with a function expression
! in an array constructor. 
program main
  implicit none
  integer, parameter :: dp=selected_real_kind(15)
  real(kind=dp), dimension(2,2) :: a
  real(kind=dp) thirteen

  data a /2._dp,3._dp,5._dp,7._dp/
  thirteen = 13._dp
  if (abs (product([[sum([eleven_ones()]), thirteen], a]) - 30030._dp) > 1e-8) STOP 1
 contains
  function eleven_ones()
    real(kind=dp) :: eleven_ones(11)
    integer       :: i

    eleven_ones = [ (1._dp, i=1,11) ]
  end function eleven_ones
end program main
! { dg-final { scan-tree-dump-times "while" 4 "original" } }