summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/graphite/id-18.f90
blob: ed780673655cacccc8e59ea6d1418e5be59d34cf (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
MODULE spherical_harmonics
  INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND ( 14, 200 )
CONTAINS
  FUNCTION dlegendre (x, l, m) RESULT (dplm)
  SELECT CASE ( l )
  CASE ( 0 )
    dplm = 0.0_dp
  CASE ( 1 )
    dplm = 1.0_dp
  CASE DEFAULT
    IF ( mm > 0 ) THEN
      dpmm = -m
      DO im = 1, mm
        dpmm = -dpmm
      END DO
      IF ( l == mm + 1 ) THEN
        DO il = mm + 2, l
          dpll = dpmm
        END DO
        dplm = dpll
      END IF
    END IF
  END SELECT
  END FUNCTION dlegendre
END MODULE spherical_harmonics
! { dg-final { cleanup-modules "spherical_harmonics" } }