summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr32242.f90
blob: 8699e0050a180327d74c70ef00809af2c416ef7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
!PR fortran/32242
! { dg-do compile }
! { dg-options "-Wreturn-type" }

MODULE kahan_sum
  INTEGER, PARAMETER :: dp=KIND(0.0D0)
  INTERFACE accurate_sum
    MODULE PROCEDURE kahan_sum_d1, kahan_sum_z1
  END INTERFACE accurate_sum
  TYPE pw_grid_type
     REAL (KIND=dp), DIMENSION ( : ), POINTER :: gsq
  END TYPE pw_grid_type
  TYPE pw_type
     REAL (KIND=dp), DIMENSION ( : ), POINTER :: cr
     COMPLEX (KIND=dp), DIMENSION ( : ), POINTER :: cc
     TYPE ( pw_grid_type ), POINTER :: pw_grid
  END TYPE pw_type
CONTAINS
 FUNCTION kahan_sum_d1(array,mask) RESULT(ks)         ! { dg-warning "not set" }
   REAL(KIND=dp), DIMENSION(:), INTENT(IN)  :: array
   LOGICAL, DIMENSION(:), INTENT(IN), &
     OPTIONAL                               :: mask
   REAL(KIND=dp)                            :: ks
 END FUNCTION kahan_sum_d1
  FUNCTION kahan_sum_z1(array,mask) RESULT(ks)        ! { dg-warning "not set" }
    COMPLEX(KIND=dp), DIMENSION(:), &
      INTENT(IN)                             :: array
    LOGICAL, DIMENSION(:), INTENT(IN), &
      OPTIONAL                               :: mask
    COMPLEX(KIND=dp)                         :: ks
  END FUNCTION kahan_sum_z1

FUNCTION pw_integral_a2b ( pw1, pw2 ) RESULT ( integral_value )
    TYPE(pw_type), INTENT(IN)                :: pw1, pw2
    REAL(KIND=dp)                            :: integral_value
     integral_value = accurate_sum ( REAL ( CONJG ( pw1 % cc ( : ) ) &
          *  pw2 % cc ( : ) ,KIND=dp) * pw1 % pw_grid % gsq ( : ) )
END FUNCTION pw_integral_a2b
END MODULE