RISC-V: Refactor Dynamic LMUL codes
[official-gcc.git] / gcc / testsuite / gfortran.dg / function_optimize_5.f90
blobe485ea0a2e02f07a4da4916fc389bbce7445644b
1 ! { dg-do compile }
2 ! { dg-options "-ffrontend-optimize -faggressive-function-elimination -finline-matmul-limit=0 -Wfunction-elimination" }
3 ! Check the -ffrontend-optimize (in the absence of -O) and
4 ! -Wfunction-elimination options.
5 program main
6 implicit none
7 real, dimension(2,2) :: a, b, c, d
8 integer :: i
9 real :: x, z
10 character(60) :: line
11 real, external :: ext_func
12 interface
13 elemental function element(x)
14 real, intent(in) :: x
15 real :: elem
16 end function element
17 pure function mypure(x)
18 real, intent(in) :: x
19 integer :: mypure
20 end function mypure
21 elemental impure function elem_impure(x)
22 real, intent(in) :: x
23 real :: elem_impure
24 end function elem_impure
25 end interface
27 data a /2., 3., 5., 7./
28 data b /11., 13., 17., 23./
29 write (unit=line, fmt='(4F7.2)') matmul(a,b) &
30 & + matmul(a,b)
31 z = sin(x) + 2.0 + sin(x)
32 print *,z
33 x = ext_func(a) + 23 + ext_func(a) ! { dg-warning "Removing call to impure function" }
34 print *,d,x
35 z = element(x) + element(x)
36 print *,z
37 i = mypure(x) - mypure(x)
38 print *,i
39 z = elem_impure(x) - elem_impure(x) ! { dg-warning "Removing call to impure function" }
40 print *,z
41 end program main