145
|
1 /* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
|
|
2 /* { dg-enable-nn-line-numbers "" } */
|
|
3
|
|
4 #include "test-setjmp.h"
|
|
5 #include <stddef.h>
|
|
6 #include "analyzer-decls.h"
|
|
7
|
|
8 extern void foo (int);
|
|
9
|
|
10 void test_1 (void)
|
|
11 {
|
|
12 SETJMP (NULL);
|
|
13 }
|
|
14
|
|
15 void test_2 (void)
|
|
16 {
|
|
17 jmp_buf env;
|
|
18 int i;
|
|
19
|
|
20 foo (0);
|
|
21
|
|
22 i = SETJMP(env);
|
|
23
|
|
24 foo (1);
|
|
25
|
|
26 if (i != 0)
|
|
27 {
|
|
28 foo (2);
|
|
29 __analyzer_dump_path (); /* { dg-message "path" } */
|
|
30 }
|
|
31 else
|
|
32 longjmp (env, 1);
|
|
33
|
|
34 foo (3);
|
|
35 }
|
|
36
|
|
37 /* { dg-begin-multiline-output "" }
|
|
38 NN | __analyzer_dump_path ();
|
|
39 | ^~~~~~~~~~~~~~~~~~~~~~~
|
|
40 'test_2': event 1
|
|
41 |
|
|
42 | NN | i = SETJMP(env);
|
|
43 | | ^~~~~~
|
|
44 | | |
|
|
45 | | (1) 'setjmp' called here
|
|
46 |
|
|
47 'test_2': events 2-4
|
|
48 |
|
|
49 | NN | if (i != 0)
|
|
50 | | ^
|
|
51 | | |
|
|
52 | | (2) following 'false' branch (when 'i == 0')...
|
|
53 |......
|
|
54 | NN | longjmp (env, 1);
|
|
55 | | ~~~~~~~~~~~~~~~~
|
|
56 | | |
|
|
57 | | (3) ...to here
|
|
58 | | (4) rewinding within 'test_2' from 'longjmp'...
|
|
59 |
|
|
60 'test_2': event 5
|
|
61 |
|
|
62 | NN | i = SETJMP(env);
|
|
63 | | ^~~~~~
|
|
64 | | |
|
|
65 | | (5) ...to 'setjmp' (saved at (1))
|
|
66 |
|
|
67 'test_2': events 6-8
|
|
68 |
|
|
69 | NN | if (i != 0)
|
|
70 | | ^
|
|
71 | | |
|
|
72 | | (6) following 'true' branch (when 'i != 0')...
|
|
73 | NN | {
|
|
74 | NN | foo (2);
|
|
75 | | ~~~~~~~
|
|
76 | | |
|
|
77 | | (7) ...to here
|
|
78 | NN | __analyzer_dump_path ();
|
|
79 | | ~~~~~~~~~~~~~~~~~~~~~~~
|
|
80 | | |
|
|
81 | | (8) here
|
|
82 |
|
|
83 { dg-end-multiline-output "" } */
|
|
84
|
|
85 void test_3 (void)
|
|
86 {
|
|
87 longjmp (NULL, 0);
|
|
88 }
|
|
89
|
|
90 void test_4 (void)
|
|
91 {
|
|
92 longjmp (NULL, 1);
|
|
93 }
|
|
94
|
|
95 void test_5 (void)
|
|
96 {
|
|
97 jmp_buf env;
|
|
98 longjmp (env, 1);
|
|
99 }
|