(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
infinite-recursion-multiline-2.c
       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 "" } */
      56  
      57  
      58  /* { dg-begin-multiline-output "" }
      59     mutual_1 ();
      60     ^~~~~~~~~~~
      61    'mutual_1': events 1-2 (depth 1)
      62      |
      63      | void mutual_1 (void)
      64      |      ^~~~~~~~
      65      |      |
      66      |      (1) initial entry to 'mutual_1'
      67      |
      68      |   mutual_2 ();
      69      |   ~~~~~~~~~~~
      70      |   |
      71      |   (2) calling 'mutual_2' from 'mutual_1'
      72      |
      73      +--> 'mutual_2': events 3-4 (depth 2)
      74             |
      75             | void mutual_2 (void)
      76             |      ^~~~~~~~
      77             |      |
      78             |      (3) entry to 'mutual_2'
      79             |
      80             |   mutual_1 ();
      81             |   ~~~~~~~~~~~
      82             |   |
      83             |   (4) calling 'mutual_1' from 'mutual_2'
      84             |
      85             +--> 'mutual_1': events 5-6 (depth 3)
      86                    |
      87                    | void mutual_1 (void)
      88                    |      ^~~~~~~~
      89                    |      |
      90                    |      (5) recursive entry to 'mutual_1'; previously entered at (1)
      91                    |      (6) apparently infinite chain of mutually-recursive function calls, consuming 2 stack frames per recursion
      92                    |
      93     { dg-end-multiline-output "" } */