2 ! { dg-additional-options "-fdump-tree-dse-details" }
4 ! Check that pointer assignments allowed by F2003:C717
5 ! work and check null initialization of CLASS(*) pointers.
7 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
12 class(*), pointer, intent(in) :: z
15 class(*), pointer, intent(in) :: z
27 class(*), pointer :: y, z
30 z => y ! unlimited => unlimited allowed
34 z => y ! unlimited => unlimited allowed
42 class(*), pointer :: ptr1 => null() ! pointer initialization
43 if (same_type_as (ptr1, x) .neqv. .FALSE.) STOP 1
48 subroutine foo_bc(tgt)
50 class(*), pointer, intent(in) :: tgt
54 type(bc), pointer :: ptr1
55 ptr1 => tgt ! bind(c) => unlimited allowed
56 if (ptr1%i .ne. 23) STOP 2
59 subroutine foo_sq(tgt)
60 class(*), pointer, intent(in) :: tgt
65 type(sq), pointer :: ptr2
66 ptr2 => tgt ! sequence type => unlimited allowed
67 if (ptr2%k .ne. 42) STOP 3
71 ! We used to produce multiple independant types for the unlimited polymorphic
72 ! descriptors (types for class(*)) which caused stores to them to be seen as
74 ! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &w" "dse1" { target __OPTIMIZE__ } } }
75 ! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &x" "dse1" { target __OPTIMIZE__ } } }