2 ! { dg-require-visibility "" }
4 ! Tests the fix for PR68846 in which compiler generated temporaries were
5 ! receiving the attributes of dummy arguments. This test is the original.
6 ! The simplified versions by Gerhard Steinmetz are gratefully acknowledged.
8 ! Contributed by Mirco Valentini <mirco.valentini@polimi.it>
13 REAL(KIND
=8), DIMENSION(100,100), TARGET
:: WORKSPACE
14 TYPE, PUBLIC
:: grid_t
15 REAL(KIND
=8), DIMENSION(:,:), POINTER :: P
=> NULL ()
21 TYPE(grid_t
), INTENT(INOUT
) :: DAT
26 DAT
%P(I
,J
) = REAL ((I
-1)*100+J
-1)
33 USE :: grid
, ONLY
: grid_t
36 TYPE, PUBLIC
:: subgrid_t
37 INTEGER, DIMENSION(4) :: range
38 CLASS(grid_t
), POINTER :: grd
=> NULL ()
40 PROCEDURE
, PASS
:: INIT
=> LVALUE_INIT
41 PROCEDURE
, PASS
:: JMP
=> LVALUE_JMP
44 SUBROUTINE LVALUE_INIT (HOBJ
, P
, D
)
46 CLASS(subgrid_t
), INTENT(INOUT
) :: HOBJ
47 TYPE(grid_t
), POINTER, INTENT(INOUT
) :: P
48 INTEGER, DIMENSION(4), INTENT(IN
) :: D
51 END SUBROUTINE LVALUE_INIT
53 FUNCTION LVALUE_JMP(HOBJ
, I
, J
) RESULT(P
)
55 CLASS(subgrid_t
), INTENT(INOUT
) :: HOBJ
56 INTEGER, INTENT(IN
) :: I
, J
57 REAL(KIND
=8), POINTER :: P
58 P
=> HOBJ
%grd
%P(HOBJ
%range(1)+I
-1, HOBJ
%range(3)+J
-1)
59 END FUNCTION LVALUE_JMP
65 SUBROUTINE fillgeom_03( subgrid
, value
)
66 USE :: subgrid
, ONLY
: subgrid_t
68 TYPE(subgrid_T
), intent(inout
) :: subgrid
69 REAL(kind
=8), intent(in
) :: value
73 subgrid
%jmp(i
,j
) = value
! Dummy argument '_F.DA0' with INTENT(IN)
74 ! in pointer association context or ICE
75 ! in trans_decl.c, depending on INTENT of
79 END SUBROUTINE fillgeom_03
87 TYPE(grid_t
), POINTER :: GRD
=> NULL()
88 TYPE(subgrid_t
) :: STENCIL
89 REAL(KIND
=8), POINTER :: real_tmp_ptr
90 REAL(KIND
=8), DIMENSION(10,10), TARGET
:: AA
91 REAL(KIND
=8), DIMENSION(3,4) :: VAL
92 INTEGER :: I
, J
, chksum
93 integer, parameter :: r1
= 50
94 integer, parameter :: r2
= 52
95 integer, parameter :: r3
= 50
96 integer, parameter :: r4
= 53
99 VAL(I
,J
) = dble(I
)*dble(J
)
105 chksum
= sum([([((i
-1)*100 + j
-1, j
=1,100)], i
= 1,100)])
106 if (int(sum(grd
%p
)) .ne
. chksum
) stop 1
108 CALL STENCIL
%INIT (GRD
, [r1
, r2
, r3
, r4
])
109 if (.not
.associated (stencil
%grd
, grd
)) stop 2
110 if (int(sum(grd
%p
)) .ne
. chksum
) stop 3
112 CALL fillgeom_03(stencil
, 42.0_8
)
113 if (any (int (grd
%p(r1
:r2
,r3
:r4
)) .ne
. 42)) stop 4
115 chksum
= chksum
- sum([([((i
- 1) * 100 + j
-1, j
=r3
,r4
)], i
= r1
,r2
)]) &
116 + (r4
- r3
+ 1) * (r2
- r1
+1) * 42
117 if (int(sum(grd
%p
)) .ne
. chksum
) stop 5
120 END PROGRAM test_lvalue