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