gcc/testsuite/gfortran.fortran-torture/compile/allocate.f90
raw| 1 | ! Snippet to test various allocate statements |
| 2 | |
| 3 | program test_allocate |
| 4 | implicit none |
| 5 | type t |
| 6 | integer i |
| 7 | real r |
| 8 | end type |
| 9 | type pt |
| 10 | integer, pointer :: p |
| 11 | end type |
| 12 | integer, allocatable, dimension(:, :) :: a |
| 13 | type (t), pointer, dimension(:) :: b |
| 14 | type (pt), pointer :: c |
| 15 | integer, pointer:: p |
| 16 | integer n |
| 17 | |
| 18 | n = 10 |
| 19 | allocate (a(1:10, 4)) |
| 20 | allocate (a(5:n, n:14)) |
| 21 | allocate (a(6, 8)) |
| 22 | allocate (b(n)) |
| 23 | allocate (c) |
| 24 | allocate (c%p) |
| 25 | allocate (p) |
| 26 | end program |