Merge from mainline (160224:163495).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / pr42051.f03
blob308c1e7229f7f7f435793520f7cf331b43f91d92
1 ! { dg-do compile }
2 ! { dg-options "-fno-whole-file" }
4 ! PR fortran/42051
5 ! PR fortran/44064
6 ! Access to freed symbols
8 ! Testcase provided by Damian Rouson <damian@rouson.net>,
9 ! reduced by Janus Weil <janus@gcc.gnu.org>.
11 module grid_module
12   implicit none 
13   type grid
14   end type
15   type field
16     type(grid) :: mesh
17   end type
18 contains
19   real function return_x(this)
20     class(grid) :: this
21   end function
22 end module 
24 module field_module
25   use grid_module, only: field,return_x
26   implicit none 
27 contains
28   subroutine output(this)
29     class(field) :: this
30     print *,return_x(this%mesh)
31   end subroutine
32 end module
34 end
36 ! { dg-final { cleanup-modules "grid_module field_module" } }