| 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 foo (int flag) |
| 8 |
{ |
| 9 |
if (flag) |
| 10 |
foo (flag); /* { dg-warning "infinite recursion" } */ |
| 11 |
} |
| 12 |
|
| 13 |
/* { dg-begin-multiline-output "" } |
| 14 |
foo (flag); |
| 15 |
^~~~~~~~~~ |
| 16 |
'foo': events 1-4 (depth 1) |
| 17 |
| |
| 18 |
| void foo (int flag) |
| 19 |
| ^~~ |
| 20 |
| | |
| 21 |
| (1) initial entry to 'foo' |
| 22 |
| |
| 23 |
| if (flag) |
| 24 |
| ~ |
| 25 |
| | |
| 26 |
| (2) following 'true' branch (when 'flag != 0')... |
| 27 |
| foo (flag); |
| 28 |
| ~~~~~~~~~~ |
| 29 |
| | |
| 30 |
| (3) ...to here |
| 31 |
| (4) calling 'foo' from 'foo' |
| 32 |
| |
| 33 |
+--> 'foo': events 5-6 (depth 2) |
| 34 |
| |
| 35 |
| void foo (int flag) |
| 36 |
| ^~~ |
| 37 |
| | |
| 38 |
| (5) recursive entry to 'foo'; previously entered at (1) |
| 39 |
| (6) apparently infinite recursion |
| 40 |
| |
| 41 |
{ dg-end-multiline-output "" { target c } } */ |
| 42 |
/* { dg-begin-multiline-output "" } |
| 43 |
foo (flag); |
| 44 |
~~~~^~~~~~ |
| 45 |
'void foo(int)': events 1-4 (depth 1) |
| 46 |
| |
| 47 |
| void foo (int flag) |
| 48 |
| ^~~ |
| 49 |
| | |
| 50 |
| (1) initial entry to 'foo' |
| 51 |
| |
| 52 |
| if (flag) |
| 53 |
| ~~ |
| 54 |
| | |
| 55 |
| (2) following 'true' branch (when 'flag != 0')... |
| 56 |
| foo (flag); |
| 57 |
| ~~~~~~~~~~ |
| 58 |
| | |
| 59 |
| (3) ...to here |
| 60 |
| (4) calling 'foo' from 'foo' |
| 61 |
| |
| 62 |
+--> 'void foo(int)': events 5-6 (depth 2) |
| 63 |
| |
| 64 |
| void foo (int flag) |
| 65 |
| ^~~ |
| 66 |
| | |
| 67 |
| (5) recursive entry to 'foo'; previously entered at (1) |
| 68 |
| (6) apparently infinite recursion |
| 69 |
| |
| 70 |
{ dg-end-multiline-output "" { target c++ } } */ |