| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR fortran/103496 |
| 4 |
! |
| 5 |
! Test that C_SIZEOF returns the expected results |
| 6 |
|
| 7 |
program pr103496 |
| 8 |
use iso_c_binding |
| 9 |
implicit none |
| 10 |
integer :: a(6) |
| 11 |
integer, pointer :: p(:) |
| 12 |
|
| 13 |
if (c_sizeof(a) /= 6*4) stop 1 |
| 14 |
if (c_sizeof(a(1)) /= 4) stop 2 |
| 15 |
if (c_sizeof(a(:)) /= 6*4) stop 3 |
| 16 |
if (c_sizeof(a(2::2)) /= 3*4) stop 4 |
| 17 |
|
| 18 |
allocate(p(5)) |
| 19 |
if (c_sizeof(p) /= 5*4) stop 5 |
| 20 |
if (c_sizeof(p(1)) /= 4) stop 6 |
| 21 |
if (c_sizeof(p(:)) /= 5*4) stop 7 |
| 22 |
if (c_sizeof(p(2::2)) /= 2*4) stop 8 |
| 23 |
end |