Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / pr32242.f90
blob21ecdd1786c08604de520dbd4e1d9b17255763c1
1 !PR fortran/32242
2 ! { dg-do compile }
3 ! { dg-options "-Wreturn-type" }
4 ! { dg-final { cleanup-modules "kahan_sum" } }
6 MODULE kahan_sum
7 INTEGER, PARAMETER :: dp=KIND(0.0D0)
8 INTERFACE accurate_sum
9 MODULE PROCEDURE kahan_sum_d1, kahan_sum_z1
10 END INTERFACE accurate_sum
11 TYPE pw_grid_type
12 REAL (KIND=dp), DIMENSION ( : ), POINTER :: gsq
13 END TYPE pw_grid_type
14 TYPE pw_type
15 REAL (KIND=dp), DIMENSION ( : ), POINTER :: cr
16 COMPLEX (KIND=dp), DIMENSION ( : ), POINTER :: cc
17 TYPE ( pw_grid_type ), POINTER :: pw_grid
18 END TYPE pw_type
19 CONTAINS
20 FUNCTION kahan_sum_d1(array,mask) RESULT(ks) ! { dg-warning "not set" }
21 REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: array
22 LOGICAL, DIMENSION(:), INTENT(IN), &
23 OPTIONAL :: mask
24 REAL(KIND=dp) :: ks
25 END FUNCTION kahan_sum_d1
26 FUNCTION kahan_sum_z1(array,mask) RESULT(ks) ! { dg-warning "not set" }
27 COMPLEX(KIND=dp), DIMENSION(:), &
28 INTENT(IN) :: array
29 LOGICAL, DIMENSION(:), INTENT(IN), &
30 OPTIONAL :: mask
31 COMPLEX(KIND=dp) :: ks
32 END FUNCTION kahan_sum_z1
34 FUNCTION pw_integral_a2b ( pw1, pw2 ) RESULT ( integral_value )
35 TYPE(pw_type), INTENT(IN) :: pw1, pw2
36 REAL(KIND=dp) :: integral_value
37 integral_value = accurate_sum ( REAL ( CONJG ( pw1 % cc ( : ) ) &
38 * pw2 % cc ( : ) ,KIND=dp) * pw1 % pw_grid % gsq ( : ) )
39 END FUNCTION pw_integral_a2b
40 END MODULE