1  extern int could_fail_1 (void);
       2  extern void *could_fail_2 (int);
       3  extern void cleanup (void *);
       4  
       5  struct header {
       6    int signature;
       7  };
       8  
       9  int test_1 (void) {
      10    int fd, ret = 0;
      11    void *data = ((void *)0);
      12    struct header *hdr;
      13  
      14    fd = could_fail_1 ();
      15  
      16    if (fd < 0) {
      17      ret = -1;
      18      goto cleanup;
      19    }
      20  
      21    data = could_fail_2 (fd);
      22    hdr = data;
      23  
      24    if (hdr->signature != 42) {
      25      ret = -2;
      26      goto cleanup;
      27    }
      28  
      29  cleanup:
      30    if (ret) {
      31      if (data) /* { dg-bogus "check of 'data' for NULL after already dereferencing it" } */
      32        cleanup (data);
      33    }
      34  
      35    return ret;
      36  }