2 ! Test the fix for PR38863, in which an unnecessary temporary
3 ! generated results that are not consistent with other compilers.
5 ! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
12 interface assignment(=)
13 module procedure l_to_t, i_to_t
16 elemental subroutine l_to_t (arg1, arg2)
17 type(unseq), intent(inout) :: arg1
18 logical, intent(in) :: arg2
21 elemental subroutine i_to_t (arg1, arg2)
22 type(unseq), intent(inout) :: arg1
23 integer, intent(in) :: arg2
26 subroutine rg0045(nf1, nf2, nf3)
27 type(unseq) :: tla2l(nf3, nf2)
28 type(unseq) :: tda2l(3,2)
29 logical :: lda(nf3,nf2)
30 tda2l%l = reshape ([.true.,.false.,.true.,.false.,.true.,.false.],[3,2])
31 tda2l%i = reshape ([1, -1, 3, -1, 5, -1],[3,2])
34 tla2l%i = reshape ([1, 2, 3, 4, 5, 6], [3,2])
36 ! The problem occurred here: gfortran was producing a temporary for these
37 ! assignments because the dependency checking was too restrictive. Since
38 ! a temporary was used, the integer component was reset in the first assignment
39 ! rather than being carried over.
42 tla2l = tla2l(1:3, 1:2)%l
43 tla2l = tla2l(1:3, 1:2)%i
47 if (any (tla2l%i .ne. tda2l%i)) call abort
48 if (any (tla2l%l .neqv. tda2l%l)) call abort
50 end module rg0045_stuff
55 ! { dg-final { cleanup-modules "rg0045_stuff" } }