Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / setjmp-2.c
blob264764551d2a702db197622b3b0b1f4de2106754
1 /* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
2 /* { dg-enable-nn-line-numbers "" } */
3 /* { dg-require-effective-target indirect_jumps } */
5 #include "../../gcc.dg/analyzer/test-setjmp.h"
6 #include <stddef.h>
7 #include "../../gcc.dg/analyzer/analyzer-decls.h"
9 extern void foo (int);
11 void test_1 (void)
13 SETJMP (NULL);
16 void test_2 (void)
18 jmp_buf env;
19 int i;
21 foo (0);
23 i = SETJMP(env);
25 foo (1);
27 if (i != 0)
29 foo (2);
30 __analyzer_dump_path (); /* { dg-message "path" } */
32 else
33 longjmp (env, 1);
35 foo (3);
38 /* { dg-begin-multiline-output "" }
39 NN | __analyzer_dump_path ();
40 | ^~~~~~~~~~~~~~~~~~~~~~~
41 'test_2': event 1
42 NN | i = SETJMP(env);
43 | ^~~~~~
44 | |
45 | (1) 'setjmp' called here
46 'test_2': events 2-4
47 NN | if (i != 0)
48 | ^
49 | |
50 | (2) following 'false' branch (when 'i == 0')...
51 ......
52 NN | longjmp (env, 1);
53 | ~~~~~~~~~~~~~~~~
54 | |
55 | (3) ...to here
56 | (4) rewinding within 'test_2' from 'longjmp'...
57 'test_2': event 5
58 NN | i = SETJMP(env);
59 | ^~~~~~
60 | |
61 | (5) ...to 'setjmp' (saved at (1))
62 'test_2': events 6-8
63 NN | if (i != 0)
64 | ^
65 | |
66 | (6) following 'true' branch (when 'i != 0')...
67 NN | {
68 NN | foo (2);
69 | ~~~~~~~
70 | |
71 | (7) ...to here
72 NN | __analyzer_dump_path ();
73 | ~~~~~~~~~~~~~~~~~~~~~~~
74 | |
75 | (8) here
76 { dg-end-multiline-output "" { target c } } */
77 /* { dg-begin-multiline-output "" }
78 NN | __analyzer_dump_path ();
79 | ~~~~~~~~~~~~~~~~~~~~~^~
80 'void test_2()': event 1
81 NN | i = SETJMP(env);
82 | ^~~~~~
83 | |
84 | (1) 'setjmp' called here
85 'void test_2()': events 2-4
86 NN | if (i != 0)
87 | ^~
88 | |
89 | (2) following 'false' branch (when 'i == 0')...
90 ......
91 NN | longjmp (env, 1);
92 | ~~~~~~~~~~~~~~~~
93 | |
94 | (3) ...to here
95 | (4) rewinding within 'test_2' from 'longjmp'...
96 'void test_2()': event 5
97 NN | i = SETJMP(env);
98 | ^~~~~~
99 | |
100 | (5) ...to 'setjmp' (saved at (1))
101 'void test_2()': events 6-8
102 NN | if (i != 0)
103 | ^~
105 | (6) following 'true' branch (when 'i != 0')...
106 NN | {
107 NN | foo (2);
108 | ~~~~~~~
110 | (7) ...to here
111 NN | __analyzer_dump_path ();
112 | ~~~~~~~~~~~~~~~~~~~~~~~
114 | (8) here
115 { dg-end-multiline-output "" { target c++ } } */
117 void test_3 (void)
119 longjmp (NULL, 0);
122 void test_4 (void)
124 longjmp (NULL, 1);
127 void test_5 (void)
129 jmp_buf env;
130 longjmp (env, 1);