gcc/testsuite/gfortran.dg/asan/array_constructor_1.f90
raw| 1 | !{ dg-do run } |
| 2 | |
| 3 | ! Contributed by Christopher Albert <[email protected]> |
| 4 | |
| 5 | program grow_type_array |
| 6 | type :: container |
| 7 | integer, allocatable :: arr(:) |
| 8 | end type container |
| 9 | |
| 10 | type(container), allocatable :: list(:) |
| 11 | |
| 12 | list = [list, new_elem(5)] |
| 13 | |
| 14 | deallocate(list) |
| 15 | |
| 16 | contains |
| 17 | |
| 18 | type(container) function new_elem(s) result(out) |
| 19 | integer :: s |
| 20 | allocate(out%arr(s)) |
| 21 | end function new_elem |
| 22 | |
| 23 | end program grow_type_array |