| 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 "test-setjmp.h" |
| 6 |
#include <stddef.h> |
| 7 |
#include "analyzer-decls.h" |
| 8 |
|
| 9 |
extern int foo (int) __attribute__ ((__pure__)); |
| 10 |
|
| 11 |
static jmp_buf env; |
| 12 |
|
| 13 |
static void inner (void) |
| 14 |
{ |
| 15 |
/* Pass known 0 to longjmp. */ |
| 16 |
longjmp (env, 0); |
| 17 |
} |
| 18 |
|
| 19 |
void outer (void) |
| 20 |
{ |
| 21 |
int i; |
| 22 |
|
| 23 |
foo (0); |
| 24 |
|
| 25 |
i = SETJMP(env); |
| 26 |
|
| 27 |
if (i != 0) |
| 28 |
{ |
| 29 |
foo (2); |
| 30 |
__analyzer_dump_path (); /* { dg-message "path" } */ |
| 31 |
} |
| 32 |
else |
| 33 |
{ |
| 34 |
foo (1); |
| 35 |
inner (); |
| 36 |
} |
| 37 |
foo (3); |
| 38 |
} |
| 39 |
|
| 40 |
/* { dg-begin-multiline-output "" } |
| 41 |
NN | __analyzer_dump_path (); |
| 42 |
| ^~~~~~~~~~~~~~~~~~~~~~~ |
| 43 |
'outer': event 1 |
| 44 |
| |
| 45 |
| NN | void outer (void) |
| 46 |
| | ^~~~~ |
| 47 |
| | | |
| 48 |
| | (1) entry to 'outer' |
| 49 |
| |
| 50 |
'outer': event 2 |
| 51 |
| |
| 52 |
| NN | i = SETJMP(env); |
| 53 |
| | ^~~~~~ |
| 54 |
| | | |
| 55 |
| | (2) 'setjmp' called here |
| 56 |
| |
| 57 |
'outer': events 3-5 |
| 58 |
| |
| 59 |
| NN | if (i != 0) |
| 60 |
| | ^ |
| 61 |
| | | |
| 62 |
| | (3) following 'false' branch (when 'i == 0')... |
| 63 |
|...... |
| 64 |
| NN | foo (1); |
| 65 |
| | ~~~~~~~ |
| 66 |
| | | |
| 67 |
| | (4) ...to here |
| 68 |
| NN | inner (); |
| 69 |
| | ~~~~~~~~ |
| 70 |
| | | |
| 71 |
| | (5) calling 'inner' from 'outer' |
| 72 |
| |
| 73 |
+--> 'inner': events 6-7 |
| 74 |
| |
| 75 |
| NN | static void inner (void) |
| 76 |
| | ^~~~~ |
| 77 |
| | | |
| 78 |
| | (6) entry to 'inner' |
| 79 |
|...... |
| 80 |
| NN | longjmp (env, 0); |
| 81 |
| | ~~~~~~~~~~~~~~~~ |
| 82 |
| | | |
| 83 |
| | (7) rewinding from 'longjmp' in 'inner'... |
| 84 |
| |
| 85 |
<------+ |
| 86 |
| |
| 87 |
'outer': event 8 |
| 88 |
| |
| 89 |
| NN | i = SETJMP(env); |
| 90 |
| | ^~~~~~ |
| 91 |
| | | |
| 92 |
| | (8) ...to 'setjmp' in 'outer' (saved at (2)) |
| 93 |
| |
| 94 |
'outer': events 9-11 |
| 95 |
| |
| 96 |
| NN | if (i != 0) |
| 97 |
| | ^ |
| 98 |
| | | |
| 99 |
| | (9) following 'true' branch (when 'i != 0')... |
| 100 |
| NN | { |
| 101 |
| NN | foo (2); |
| 102 |
| | ~~~~~~~ |
| 103 |
| | | |
| 104 |
| | (10) ...to here |
| 105 |
| NN | __analyzer_dump_path (); |
| 106 |
| | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 107 |
| | | |
| 108 |
| | (11) here |
| 109 |
| |
| 110 |
{ dg-end-multiline-output "" } */ |