OSDN Git Service

PR target/51393
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / extends_11.f03
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
3 !
4 ! PR fortran/45586
5 ! Test that access to inherited components are properly generated
6 !
7 ! Stripped down from extends_1.f03
8 !
9   type :: person
10     integer :: ss = 1
11   end type person
12
13   type, extends(person) :: education
14     integer ::  attainment = 0
15   end type education
16
17   type, extends(education) :: service
18     integer :: personnel_number = 0
19   end type service
20
21   type, extends(service) :: person_record
22     type (person_record), pointer :: supervisor => NULL ()
23   end type person_record
24   
25   type(person_record) :: recruit
26   
27
28   ! Check that references by ultimate component and by parent type work
29   ! All the following component access are equivalent
30   recruit%ss = 2
31   recruit%person%ss = 3
32   recruit%education%ss = 4
33   recruit%education%person%ss = 5
34   recruit%service%ss = 6
35   recruit%service%person%ss = 7
36   recruit%service%education%ss = 8
37   recruit%service%education%person%ss = 9
38 end
39
40 ! { dg-final { scan-tree-dump-times " +recruit\\.service\\.education\\.person\\.ss =" 8 "original"} }
41 ! { dg-final { cleanup-tree-dump "original" } }