| 1 |
/* As per inlining-2.c, but testing how the ASCII art version of |
| 2 |
the path looks. */ |
| 3 |
|
| 4 |
/* { dg-additional-options "-O2 -fdiagnostics-show-path-depths" } */ |
| 5 |
/* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */ |
| 6 |
|
| 7 |
static void __analyzer_foo (void *p) |
| 8 |
{ |
| 9 |
__builtin_free (p); |
| 10 |
|
| 11 |
__builtin_free (p); /* { dg-warning "double-'free' of 'q'" "warning" } */ |
| 12 |
} |
| 13 |
|
| 14 |
void bar (void *q) |
| 15 |
{ |
| 16 |
__analyzer_foo (q); |
| 17 |
} |
| 18 |
|
| 19 |
/* { dg-begin-multiline-output "" } |
| 20 |
__builtin_free (p); |
| 21 |
^~~~~~~~~~~~~~~~~~ |
| 22 |
'bar': events 1-2 (depth 1) |
| 23 |
| |
| 24 |
| void bar (void *q) |
| 25 |
| ^~~ |
| 26 |
| | |
| 27 |
| (1) entry to 'bar' |
| 28 |
| |
| 29 |
| __analyzer_foo (q); |
| 30 |
| ~ |
| 31 |
| | |
| 32 |
| (2) inlined call to '__analyzer_foo' from 'bar' |
| 33 |
| |
| 34 |
+--> '__analyzer_foo': events 3-4 (depth 2) |
| 35 |
| |
| 36 |
| __builtin_free (p); |
| 37 |
| ^~~~~~~~~~~~~~~~~~ |
| 38 |
| | |
| 39 |
| (3) first 'free' here |
| 40 |
| |
| 41 |
| __builtin_free (p); |
| 42 |
| ~~~~~~~~~~~~~~~~~~ |
| 43 |
| | |
| 44 |
| (4) second 'free' here; first 'free' was at (3) |
| 45 |
| |
| 46 |
{ dg-end-multiline-output "" { target c } } */ |
| 47 |
/* { dg-begin-multiline-output "" } |
| 48 |
__builtin_free (p); |
| 49 |
~~~~~~~~~~~~~~~^~~ |
| 50 |
'void bar(void*)': events 1-2 (depth 1) |
| 51 |
| |
| 52 |
| void bar (void *q) |
| 53 |
| ^~~ |
| 54 |
| | |
| 55 |
| (1) entry to 'bar' |
| 56 |
| |
| 57 |
| __analyzer_foo (q); |
| 58 |
| ~ |
| 59 |
| | |
| 60 |
| (2) inlined call to '__analyzer_foo' from 'bar' |
| 61 |
| |
| 62 |
+--> 'void __analyzer_foo(void*)': events 3-4 (depth 2) |
| 63 |
| |
| 64 |
| __builtin_free (p); |
| 65 |
| ~~~~~~~~~~~~~~~^~~ |
| 66 |
| | |
| 67 |
| (3) first 'free' here |
| 68 |
| |
| 69 |
| __builtin_free (p); |
| 70 |
| ~~~~~~~~~~~~~~~~~~ |
| 71 |
| | |
| 72 |
| (4) second 'free' here; first 'free' was at (3) |
| 73 |
| |
| 74 |
{ dg-end-multiline-output "" { target c++ } } */ |