| 1 |
/* Integration test of how the execution path looks for |
| 2 |
-Wanalyzer-infinite-recursion. */ |
| 3 |
|
| 4 |
/* { dg-additional-options "-fdiagnostics-show-path-depths" } */ |
| 5 |
/* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */ |
| 6 |
|
| 7 |
void mutual_2 (void); |
| 8 |
|
| 9 |
void mutual_1 (void) |
| 10 |
{ |
| 11 |
mutual_2 (); /* { dg-warning "infinite recursion" } */ |
| 12 |
} |
| 13 |
|
| 14 |
void mutual_2 (void) |
| 15 |
{ |
| 16 |
mutual_1 (); /* { dg-warning "infinite recursion" } */ |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
/* { dg-begin-multiline-output "" } |
| 21 |
mutual_2 (); |
| 22 |
^~~~~~~~~~~ |
| 23 |
'mutual_2': events 1-2 (depth 1) |
| 24 |
| |
| 25 |
| void mutual_2 (void) |
| 26 |
| ^~~~~~~~ |
| 27 |
| | |
| 28 |
| (1) initial entry to 'mutual_2' |
| 29 |
| |
| 30 |
| mutual_1 (); |
| 31 |
| ~~~~~~~~~~~ |
| 32 |
| | |
| 33 |
| (2) calling 'mutual_1' from 'mutual_2' |
| 34 |
| |
| 35 |
+--> 'mutual_1': events 3-4 (depth 2) |
| 36 |
| |
| 37 |
| void mutual_1 (void) |
| 38 |
| ^~~~~~~~ |
| 39 |
| | |
| 40 |
| (3) entry to 'mutual_1' |
| 41 |
| |
| 42 |
| mutual_2 (); |
| 43 |
| ~~~~~~~~~~~ |
| 44 |
| | |
| 45 |
| (4) calling 'mutual_2' from 'mutual_1' |
| 46 |
| |
| 47 |
+--> 'mutual_2': events 5-6 (depth 3) |
| 48 |
| |
| 49 |
| void mutual_2 (void) |
| 50 |
| ^~~~~~~~ |
| 51 |
| | |
| 52 |
| (5) recursive entry to 'mutual_2'; previously entered at (1) |
| 53 |
| (6) apparently infinite chain of mutually-recursive function calls, consuming 2 stack frames per recursion |
| 54 |
| |
| 55 |
{ dg-end-multiline-output "" { target c } } */ |
| 56 |
/* { dg-begin-multiline-output "" } |
| 57 |
mutual_2 (); |
| 58 |
~~~~~~~~~^~ |
| 59 |
'void mutual_2()': events 1-2 (depth 1) |
| 60 |
| |
| 61 |
| void mutual_2 (void) |
| 62 |
| ^~~~~~~~ |
| 63 |
| | |
| 64 |
| (1) initial entry to 'mutual_2' |
| 65 |
| |
| 66 |
| mutual_1 (); |
| 67 |
| ~~~~~~~~~~~ |
| 68 |
| | |
| 69 |
| (2) calling 'mutual_1' from 'mutual_2' |
| 70 |
| |
| 71 |
+--> 'void mutual_1()': events 3-4 (depth 2) |
| 72 |
| |
| 73 |
| void mutual_1 (void) |
| 74 |
| ^~~~~~~~ |
| 75 |
| | |
| 76 |
| (3) entry to 'mutual_1' |
| 77 |
| |
| 78 |
| mutual_2 (); |
| 79 |
| ~~~~~~~~~~~ |
| 80 |
| | |
| 81 |
| (4) calling 'mutual_2' from 'mutual_1' |
| 82 |
| |
| 83 |
+--> 'void mutual_2()': events 5-6 (depth 3) |
| 84 |
| |
| 85 |
| void mutual_2 (void) |
| 86 |
| ^~~~~~~~ |
| 87 |
| | |
| 88 |
| (5) recursive entry to 'mutual_2'; previously entered at (1) |
| 89 |
| (6) apparently infinite chain of mutually-recursive function calls, consuming 2 stack frames per recursion |
| 90 |
| |
| 91 |
{ dg-end-multiline-output "" { target c++ } } */ |
| 92 |
|
| 93 |
|
| 94 |
/* { dg-begin-multiline-output "" } |
| 95 |
mutual_1 (); |
| 96 |
^~~~~~~~~~~ |
| 97 |
'mutual_1': events 1-2 (depth 1) |
| 98 |
| |
| 99 |
| void mutual_1 (void) |
| 100 |
| ^~~~~~~~ |
| 101 |
| | |
| 102 |
| (1) initial entry to 'mutual_1' |
| 103 |
| |
| 104 |
| mutual_2 (); |
| 105 |
| ~~~~~~~~~~~ |
| 106 |
| | |
| 107 |
| (2) calling 'mutual_2' from 'mutual_1' |
| 108 |
| |
| 109 |
+--> 'mutual_2': events 3-4 (depth 2) |
| 110 |
| |
| 111 |
| void mutual_2 (void) |
| 112 |
| ^~~~~~~~ |
| 113 |
| | |
| 114 |
| (3) entry to 'mutual_2' |
| 115 |
| |
| 116 |
| mutual_1 (); |
| 117 |
| ~~~~~~~~~~~ |
| 118 |
| | |
| 119 |
| (4) calling 'mutual_1' from 'mutual_2' |
| 120 |
| |
| 121 |
+--> 'mutual_1': events 5-6 (depth 3) |
| 122 |
| |
| 123 |
| void mutual_1 (void) |
| 124 |
| ^~~~~~~~ |
| 125 |
| | |
| 126 |
| (5) recursive entry to 'mutual_1'; previously entered at (1) |
| 127 |
| (6) apparently infinite chain of mutually-recursive function calls, consuming 2 stack frames per recursion |
| 128 |
| |
| 129 |
{ dg-end-multiline-output "" { target c } } */ |
| 130 |
/* { dg-begin-multiline-output "" } |
| 131 |
mutual_1 (); |
| 132 |
~~~~~~~~~^~ |
| 133 |
'void mutual_1()': events 1-2 (depth 1) |
| 134 |
| |
| 135 |
| void mutual_1 (void) |
| 136 |
| ^~~~~~~~ |
| 137 |
| | |
| 138 |
| (1) initial entry to 'mutual_1' |
| 139 |
| |
| 140 |
| mutual_2 (); |
| 141 |
| ~~~~~~~~~~~ |
| 142 |
| | |
| 143 |
| (2) calling 'mutual_2' from 'mutual_1' |
| 144 |
| |
| 145 |
+--> 'void mutual_2()': events 3-4 (depth 2) |
| 146 |
| |
| 147 |
| void mutual_2 (void) |
| 148 |
| ^~~~~~~~ |
| 149 |
| | |
| 150 |
| (3) entry to 'mutual_2' |
| 151 |
| |
| 152 |
| mutual_1 (); |
| 153 |
| ~~~~~~~~~~~ |
| 154 |
| | |
| 155 |
| (4) calling 'mutual_1' from 'mutual_2' |
| 156 |
| |
| 157 |
+--> 'void mutual_1()': events 5-6 (depth 3) |
| 158 |
| |
| 159 |
| void mutual_1 (void) |
| 160 |
| ^~~~~~~~ |
| 161 |
| | |
| 162 |
| (5) recursive entry to 'mutual_1'; previously entered at (1) |
| 163 |
| (6) apparently infinite chain of mutually-recursive function calls, consuming 2 stack frames per recursion |
| 164 |
| |
| 165 |
{ dg-end-multiline-output "" { target c++ } } */ |