2 ! { dg-options "-fdump-tree-original" }
4 ! Test the fix for PR43243, where unnecessary calls to internal_pack/unpack
5 ! were being produced below. These references are contiguous and so do not
6 ! need a temporary. In addition, the final call to 'bar' required a pack/unpack
7 ! which had been missing since r156680, at least.
9 ! Contributed Tobias Burnus <burnus@gcc.gnu.org>
13 integer, allocatable
:: a(:)
14 integer, pointer :: b(:)
19 subroutine foo(a
,d
,e
,n
)
24 type(t
), allocatable
:: d(:)
25 type(t
), pointer :: e(:)
26 call bar( a
%a
) ! OK - no array temp needed
27 call bar( a
%c
) ! OK - no array temp needed
29 call bar( a
%a(1:n
)) ! Missed: No pack needed
30 call bar( a
%b(1:n
)) ! OK: pack needed
31 call bar( a
%c(1:n
)) ! Missed: No pack needed
33 call bar(d(1)%a(1:n
)) ! Missed: No pack needed
34 call bar(d(1)%b(1:n
)) ! OK: pack needed
35 call bar(d(1)%c(1:n
)) ! Missed: No pack needed
37 call bar(e(1)%a(1:n
)) ! Missed: No pack needed
38 call bar(e(1)%b(1:n
)) ! OK: pack needed
39 call bar(e(1)%c(1:n
)) ! Missed: No pack needed
45 integer, target
:: z(6)
50 call bar(y
%b
) ! Missed: Pack needed
56 if (any (x(1:3) /= [1,3,5])) call abort ()
58 ! { dg-final { scan-tree-dump-times "unpack" 4 "original" } }