| 1 |
#include "analyzer-decls.h" |
| 2 |
|
| 3 |
void test_1 (int n) |
| 4 |
{ |
| 5 |
struct |
| 6 |
{ |
| 7 |
char a[n], b; |
| 8 |
} s; |
| 9 |
s.a[0] = 42; |
| 10 |
__analyzer_eval (s.a[0] == 42); /* { dg-warning "TRUE" } */ |
| 11 |
s.b = 17; |
| 12 |
__analyzer_eval (s.b == 17); /* { dg-warning "TRUE" } */ |
| 13 |
} |
| 14 |
|
| 15 |
void test_2 (int n) |
| 16 |
{ |
| 17 |
int arr[n]; /* { dg-message "region created on stack here" } */ |
| 18 |
__builtin_free (arr); /* { dg-warning "'free' of '<unknown>' which points to memory on the stack" } */ |
| 19 |
// TODO: fix the "unknown" here |
| 20 |
} |
| 21 |
|
| 22 |
/* { dg-prune-output "\\\[-Wfree-nonheap-object" } */ |