2 ! Check the fix for PR38863 comment #1, where defined assignment
3 ! to derived types was not treating components correctly that were
6 ! Contributed by Mikael Morin <mikael@gcc.gnu.org>
15 interface assignment (=)
16 module procedure i_to_t, i_to_ti
19 elemental subroutine i_to_ti (p, q)
20 type(ti), intent(out) :: p
21 integer, intent(in) :: q
24 elemental subroutine i_to_t (p, q)
25 type(t), intent(out) :: p
26 integer, intent(in) :: q
32 call test_t ! Check original problem
33 call test_ti ! Default initializers were treated wrongly
36 type(t), target :: a(3)
37 type(t), target :: b(3)
38 type(t), dimension(:), pointer :: p
50 a = p%i ! Comment #1 of PR38863 concerned WHERE assignment
52 if (any (a%j .ne. [101, 102, 103])) call abort
54 a = p%i ! Ordinary assignment was wrong too.
55 if (any (a%j .ne. [101, 102, 103])) call abort
59 type(ti), target :: a(3)
60 type(ti), target :: b(3)
61 type(ti), dimension(:), pointer :: p
75 if (any (a%j .ne. 99)) call abort
78 if (any (a%j .ne. 99)) call abort
81 ! { dg-final { cleanup-modules "m" } }