| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdump-tree-original" } |
| 3 |
! |
| 4 |
! Ensure that for zero-sized array, nonzero memory is allocated |
| 5 |
! |
| 6 |
type t |
| 7 |
end type t |
| 8 |
|
| 9 |
type(t), allocatable :: x, y(:) |
| 10 |
|
| 11 |
x = t() |
| 12 |
y = [ t :: ] |
| 13 |
|
| 14 |
if (.not. allocated (x)) STOP 1 |
| 15 |
if (.not. allocated (y)) STOP 2 |
| 16 |
end |
| 17 |
|
| 18 |
! { dg-final { scan-tree-dump "x = \\(struct t .\\) __builtin_malloc \\(1\\);" "original" } } |
| 19 |
! { dg-final { scan-tree-dump "y.data = \\(void . restrict\\) __builtin_malloc \\(1\\);" "original" } } |