blob: fd68944b339f370455f6c789ad833a6dfcfe8559 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* Verify that we print event links for the analyzer, using ASCII.
C only: we don't care about any C/C++ differences between source
locations here. */
/* { dg-additional-options "-fdiagnostics-path-format=inline-events" } */
/* { dg-additional-options "-fdiagnostics-show-line-numbers" } */
/* { dg-additional-options "-fdiagnostics-show-caret" } */
/* { dg-additional-options "-fdiagnostics-show-event-links" } */
/* { dg-enable-nn-line-numbers "" } */
void test (int flag_a, int val, void *p)
{
if (flag_a)
__builtin_free (p);
switch (val)
{
default:
break;
case 41:
break;
case 42:
__builtin_free (p); /* { dg-warning "double-'free' of 'p'" } */
break;
case 43:
break;
}
}
/* { dg-begin-multiline-output "" }
NN | __builtin_free (p);
| ^~~~~~~~~~~~~~~~~~
'test': events 1-6
NN | if (flag_a)
| ^
| |
| (1) following 'true' branch (when 'flag_a != 0')... ->-+
| |
| |
|+------------------------------------------------------------+
NN || __builtin_free (p);
|| ~~~~~~~~~~~~~~~~~~
|| |
|+--->(2) ...to here
| (3) first 'free' here
NN | switch (val)
| ~~~~~~
| |
| (4) following 'case 42:' branch... ->-+
| |
......
| |
|+----------------------------------------+
NN || case 42:
|| ~~~~
|| |
|+--->(5) ...to here
NN | __builtin_free (p);
| ~~~~~~~~~~~~~~~~~~
| |
| (6) second 'free' here; first 'free' was at (3)
{ dg-end-multiline-output "" } */
|