summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/internal_pack_8.f90
blob: 91d6a664639df7170c2123c52afe727326f18f53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
! { dg-do run }
!
! Test the fix for PR43111, in which necessary calls to
! internal PACK/UNPACK were not being generated because
! of an over agressive fix to PR41113/7.
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
SUBROUTINE S2(I)
 INTEGER :: I(4)
 !write(6,*) I
 IF (ANY(I.NE.(/3,5,7,9/))) CALL ABORT()
END SUBROUTINE S2

MODULE M1
 TYPE T1
  INTEGER, POINTER, DIMENSION(:) :: data
 END TYPE T1
CONTAINS
 SUBROUTINE S1()
   TYPE(T1) :: d
   INTEGER, TARGET, DIMENSION(10) :: scratch=(/(i,i=1,10)/)
   INTEGER :: i=2
   d%data=>scratch(1:9:2)
!   write(6,*) d%data(i:)
   CALL S2(d%data(i:))
 END SUBROUTINE S1
END MODULE M1

USE M1
CALL S1
END
! { dg-final { cleanup-modules "M1" } }