5 ! Module "bug" contributed by Martin Steghöfer.
10 INTEGER, ALLOCATABLE
:: VALUE
13 SUBROUTINE POINTER_INTENT_IN_BUG_WORKING(POINTER_INTENT_IN_VARIABLE
)
14 TYPE(MY_TYPE
), POINTER, INTENT(IN
) :: POINTER_INTENT_IN_VARIABLE
15 TYPE(MY_TYPE
), POINTER :: POINTER_VARIABLE_LOCAL
16 INTEGER, ALLOCATABLE
:: LOCAL_VALUE
18 POINTER_VARIABLE_LOCAL
=>POINTER_INTENT_IN_VARIABLE
19 CALL MOVE_ALLOC(POINTER_VARIABLE_LOCAL
%VALUE
, LOCAL_VALUE
)
22 END SUBROUTINE POINTER_INTENT_IN_BUG_WORKING
24 SUBROUTINE POINTER_INTENT_IN_BUG_FAILING(POINTER_INTENT_IN_VARIABLE
)
25 TYPE(MY_TYPE
), POINTER, INTENT(IN
) :: POINTER_INTENT_IN_VARIABLE
26 INTEGER, ALLOCATABLE
:: LOCAL_VALUE
28 CALL MOVE_ALLOC(POINTER_INTENT_IN_VARIABLE
%VALUE
, LOCAL_VALUE
)
31 END SUBROUTINE POINTER_INTENT_IN_BUG_FAILING
36 INTEGER, ALLOCATABLE
:: VALUE
40 type(MY_TYPE
), intent(in
) :: dt
41 INTEGER, ALLOCATABLE
:: lv
42 call move_alloc(dt
%VALUE
, lv
) ! { dg-error "cannot be INTENT.IN." }
46 subroutine test2 (x
, px
)
49 integer, allocatable
:: a
53 type(t
), pointer :: ptr
54 integer, allocatable
:: a
57 type(t2
), intent(in
) :: x
58 type(t2
), pointer, intent(in
) :: px
60 integer, allocatable
:: a
61 type(t2
), pointer :: ta
63 call move_alloc (px
, ta
) ! { dg-error "cannot be INTENT.IN." }
64 call move_alloc (x
%a
, a
) ! { dg-error "cannot be INTENT.IN." }
65 call move_alloc (x
%ptr
%a
, a
) ! OK (3)
66 call move_alloc (px
%a
, a
) ! OK (4)
67 call move_alloc (px
%ptr
%a
, a
) ! OK (5)
70 subroutine test3 (x
, px
)
73 integer, allocatable
:: a
77 class(t
), pointer :: ptr
78 integer, allocatable
:: a
81 type(t2
), intent(in
) :: x
82 class(t2
), pointer, intent(in
) :: px
84 integer, allocatable
:: a
85 class(t2
), pointer :: ta
87 call move_alloc (px
, ta
) ! { dg-error "cannot be INTENT.IN." }
88 call move_alloc (x
%a
, a
) ! { dg-error "cannot be INTENT.IN." }
89 call move_alloc (x
%ptr
%a
, a
) ! OK (6)
90 call move_alloc (px
%a
, a
) ! OK (7)
91 call move_alloc (px
%ptr
%a
, a
) ! OK (8)
96 INTEGER, ALLOCATABLE
:: VALUE
100 CLASS(MY_TYPE
), intent(in
) :: dt
101 INTEGER, ALLOCATABLE
:: lv
102 call move_alloc(dt
%VALUE
, lv
) ! { dg-error "cannot be INTENT.IN." }