1  #define NULL ((void *)0)
       2  
       3  void calling_null_fn_ptr_1 (void)
       4  {
       5    void (*fn_ptr) (void) = NULL;
       6    fn_ptr (); /* { dg-warning "jump through null pointer" } */
       7  }
       8  
       9  int calling_null_fn_ptr_2 (void)
      10  {
      11    int (*fn_ptr) (void) = NULL;
      12    return fn_ptr (); /* { dg-warning "jump through null pointer" } */
      13  }
      14  
      15  typedef void (*void_void_fn_ptr) (void);
      16  
      17  void calling_const_fn_ptr (void)
      18  {
      19    void_void_fn_ptr fn_ptr = (void_void_fn_ptr)0xffd2;
      20    return fn_ptr ();
      21  }
      22  
      23  void skipping_init (int flag)
      24  {
      25    void_void_fn_ptr fn_ptr = NULL;
      26    if (flag) /* { dg-message "branch" } */
      27      fn_ptr = (void_void_fn_ptr)0xffd2;
      28    fn_ptr (); /* { dg-warning "jump through null pointer" } */
      29  }
      30  
      31  struct callbacks
      32  {
      33    void_void_fn_ptr on_redraw;
      34    void_void_fn_ptr on_cleanup;  
      35  };
      36  
      37  void test_callbacks (void)
      38  {
      39    struct callbacks cb;
      40    __builtin_memset (&cb, 0, sizeof (cb));
      41    cb.on_cleanup (); /* { dg-warning "jump through null pointer" } */
      42  }