c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr112316.f90
blobdf4dad76c4884cd6b790c23e99d023bbab6ed35f
1 ! { dg-do compile }
3 ! This contains both testcases in the PR
5 ! Contributed by Tomas Trnka <trnka@scm.com>
7 ! First testcase
8 module BogusPointerArgError
9 implicit none
11 type :: AType
12 end type
14 contains
16 subroutine A ()
18 class(AType), allocatable :: x
20 allocate(x)
21 call B (x) ! Was an error here
22 end subroutine
24 subroutine B (y)
25 class(AType), intent(in) :: y
26 end subroutine
28 subroutine C (z)
29 class(AType), intent(in) :: z(:)
31 associate (xxx => z(1))
32 end associate
34 end subroutine
36 end module
38 ! Second testcase
39 module AModule
40 implicit none
41 private
43 public AType
45 type, abstract :: AType
46 contains
47 generic, public :: assignment(=) => Assign
49 procedure, private :: Assign
50 end type AType
52 contains
54 subroutine Assign(lhs, rhs)
55 class(AType), intent(inout) :: lhs
56 class(AType), intent(in) :: rhs
57 end subroutine
59 end module AModule
63 module ICEGetDescriptorField
64 use AModule
65 implicit none
67 contains
69 subroutine Foo (x)
70 class(AType), intent(in) :: x(:)
72 class(AType), allocatable :: y
74 associate (xxx => x(1))
75 y = xxx ! Was an ICE here
76 end associate
77 end subroutine
79 end module ICEGetDescriptorField