gcc/testsuite/gfortran.dg/analyzer/malloc.f90
raw| 1 | ! { dg-do compile } |
| 2 | ! { dg-additional-options "-fcray-pointer -O0" } |
| 3 | |
| 4 | subroutine test_ok |
| 5 | real*8 x(*) |
| 6 | pointer(ptr_x,x) |
| 7 | |
| 8 | ptr_x = malloc(20*8) |
| 9 | call free(ptr_x) |
| 10 | end subroutine test_ok ! { dg-bogus "leak" } |
| 11 | |
| 12 | subroutine test_double_free |
| 13 | real*8 x(*) |
| 14 | pointer(ptr_x,x) |
| 15 | |
| 16 | ptr_x = malloc(20*8) |
| 17 | call free(ptr_x) |
| 18 | call free(ptr_x) ! { dg-warning "double-'free'" } |
| 19 | end subroutine test_double_free ! { dg-bogus "leak" } |