OSDN Git Service

2011-04-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / char_length_15.f90
1 ! { dg-do run }
2 !
3 ! Test the fix for PR38915 in which the character length of the
4 ! temporaries produced in the assignments marked below was set to
5 ! one.
6 !
7 ! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
8 !
9 program cg0033_41
10   type t
11     sequence
12     integer i
13     character(len=9) c
14   end type t
15   type (t)  L(3),R(3), LL(4), RR(4)
16   EQUIVALENCE (L,LL)
17   integer nfv1(3), nfv2(3)
18   R(1)%c = '123456789'
19   R(2)%c = 'abcdefghi'
20   R(3)%c = '!@#$%^&*('
21   L%c = R%c
22   LL(1:3)%c = R%c
23   LL(4)%c = 'QWERTYUIO'
24   RR%c = LL%c            ! The equivalence forces a dependency
25   L%c = LL(2:4)%c
26   if (any (RR(2:4)%c .ne. L%c)) call abort
27   nfv1 = (/1,2,3/)
28   nfv2 = nfv1
29   L%c = R%c
30   L(nfv1)%c = L(nfv2)%c  ! The vector indices force a dependency
31   if (any (R%c .ne. L%c)) call abort
32 end
33