| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fcheck=pointer -fdump-tree-optimized -O -fno-inline" } |
| 3 |
! |
| 4 |
! PR fortran/48958 |
| 5 |
! |
| 6 |
! Initialize non-saved pointers with -fcheck=pointer to support runtime checks |
| 7 |
! of uses of possibly undefined pointers |
| 8 |
|
| 9 |
program p |
| 10 |
implicit none |
| 11 |
call s |
| 12 |
contains |
| 13 |
subroutine s |
| 14 |
integer, pointer :: a(:) |
| 15 |
integer, pointer :: b(:) => NULL() |
| 16 |
if (size (a) /= 0) stop 1 |
| 17 |
if (size (b) /= 0) stop 2 |
| 18 |
print *, size (a) |
| 19 |
print *, size (b) |
| 20 |
end |
| 21 |
end |
| 22 |
|
| 23 |
! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 1 "optimized" } } |
| 24 |
! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "optimized" } } |