| 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 } */ |
| 4 |
|
| 5 |
#include "../../gcc.dg/analyzer/test-setjmp.h" |
| 6 |
#include <stddef.h> |
| 7 |
#include "../../gcc.dg/analyzer/analyzer-decls.h" |
| 8 |
|
| 9 |
extern void foo (int); |
| 10 |
|
| 11 |
void test_1 (void) |
| 12 |
{ |
| 13 |
SETJMP (NULL); |
| 14 |
} |
| 15 |
|
| 16 |
void test_2 (void) |
| 17 |
{ |
| 18 |
jmp_buf env; |
| 19 |
int i; |
| 20 |
|
| 21 |
foo (0); |
| 22 |
|
| 23 |
i = SETJMP(env); |
| 24 |
|
| 25 |
foo (1); |
| 26 |
|
| 27 |
if (i != 0) |
| 28 |
{ |
| 29 |
foo (2); |
| 30 |
__analyzer_dump_path (); /* { dg-message "path" } */ |
| 31 |
} |
| 32 |
else |
| 33 |
longjmp (env, 1); |
| 34 |
|
| 35 |
foo (3); |
| 36 |
} |
| 37 |
|
| 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 |
| ^~ |
| 104 |
| | |
| 105 |
| (6) following 'true' branch (when 'i != 0')... |
| 106 |
NN | { |
| 107 |
NN | foo (2); |
| 108 |
| ~~~~~~~ |
| 109 |
| | |
| 110 |
| (7) ...to here |
| 111 |
NN | __analyzer_dump_path (); |
| 112 |
| ~~~~~~~~~~~~~~~~~~~~~~~ |
| 113 |
| | |
| 114 |
| (8) here |
| 115 |
{ dg-end-multiline-output "" { target c++ } } */ |
| 116 |
|
| 117 |
void test_3 (void) |
| 118 |
{ |
| 119 |
longjmp (NULL, 0); |
| 120 |
} |
| 121 |
|
| 122 |
void test_4 (void) |
| 123 |
{ |
| 124 |
longjmp (NULL, 1); |
| 125 |
} |
| 126 |
|
| 127 |
void test_5 (void) |
| 128 |
{ |
| 129 |
jmp_buf env; |
| 130 |
longjmp (env, 1); |
| 131 |
} |