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