(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
signal-registration-loc.c
       1  /* Ensure we use the correct location when reporting where the
       2     signal handler was registered (PR analyzer/95188).  */
       3  
       4  /* { dg-require-effective-target signal } */
       5  
       6  #include <stdio.h>
       7  #include <signal.h>
       8  
       9  int g;
      10  extern int foo (void);
      11  
      12  static void
      13  handler (int n)
      14  {
      15    fprintf (stderr, "got here: %i\n", g); /* { dg-warning "call to 'fprintf' from within signal handler" } */
      16  }
      17  
      18  int main (int argc, char *argv[])
      19  {
      20    g = foo (); /* { dg-bogus "registering" } */
      21    signal (SIGSEGV, handler); /* { dg-message "registering 'handler' as signal handler" } */
      22    return 0;
      23  }