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