2 ! Test the fix for PR43843, in which the temporary for b(1) in
3 ! test_member was an indirect reference, rather then the value.
5 ! Contributed by Kyle Horne <horne.kyle@gmail.com>
6 ! Reported by Tobias Burnus <burnus@gcc.gno.org>
7 ! Reported by Harald Anlauf <anlauf@gmx.de> (PR43841)
11 complex, parameter :: i = (0.0,1.0)
12 real, parameter :: pi = 3.14159265359
13 real, parameter :: e = exp (1.0)
17 type(polar_t) :: one = polar_t (1.0, 0)
19 module procedure div_pp
21 interface operator(.ne.)
22 module procedure ne_pp
25 elemental function div_pp(u,v) result(o)
26 type(polar_t), intent(in) :: u, v
29 a = u%l*exp (i*u%th*pi)
30 b = v%l*exp (i*v%th*pi)
33 o%th = atan2 (imag (c), real (c))/pi
35 elemental function ne_pp(u,v) result(o)
36 type(polar_t), intent(in) :: u, v
38 if (u%l .ne. v%l) then
40 else if (u%th .ne. v%th) then
56 subroutine test_member
57 type(polar_t), dimension(3) :: b
60 if (any (b .ne. one)) call abort
61 end subroutine test_member
63 type(polar_t), dimension(3) :: b
64 type(polar_t), dimension(3) :: c
68 if (any (b .ne. one)) call abort
69 end subroutine test_other
70 subroutine test_scalar
71 type(polar_t), dimension(3) :: b
76 if (any (b .ne. one)) call abort
77 end subroutine test_scalar
79 real,dimension(3) :: b
84 if (any (b .ne. real_one)) call abort
85 end subroutine test_real
87 ! { dg-final { cleanup-modules "polar_mod" } }