1  /* Reduced from haproxy-2.7.1: src/tcpcheck.c.  */
       2  
       3  #define NULL ((void *)0)
       4  
       5  int
       6  test_1 (char **args, int cur_arg)
       7  {
       8    char *p = NULL;
       9  
      10    if (*args[cur_arg]) {
      11      p = args[cur_arg];
      12    }
      13  
      14    if (p) { /* { dg-bogus "check of 'p' for NULL after already dereferencing it" } */
      15      return 1;
      16    }
      17    return 0;
      18  }
      19  
      20  int
      21  test_2 (char **args, int cur_arg)
      22  {
      23    char *p = NULL;
      24    char *q = NULL;
      25  
      26    if (*args[cur_arg]) {
      27      if (*args[cur_arg + 1]) {
      28        p = args[cur_arg];
      29      } else {
      30        q = args[cur_arg];
      31      }      
      32    }
      33  
      34    if (p) { /* { dg-bogus "check of 'p' for NULL after already dereferencing it" } */
      35      return 1;
      36    }
      37    if (q) { /* { dg-bogus "check of 'q' for NULL after already dereferencing it" } */
      38      return 2;
      39    }
      40    return 0;
      41  }
      42  
      43  int test_3 (void **pp, int flag)
      44  {
      45    void *p = NULL;
      46    if (*pp && flag)
      47      p = pp;
      48    if (p) /* { dg-bogus "check of 'p' for NULL after already dereferencing it" } */
      49      return 1;
      50    return 0;    
      51  }