(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
data-model-14.c
       1  #include <stdlib.h>
       2  
       3  void *global_ptr;
       4  
       5  void test_1 (int i)
       6  {
       7    global_ptr = malloc (1024); /* { dg-message "allocated here" } */
       8    *(int *)&global_ptr = i; /* { dg-warning "leak of 'global_ptr'" } */
       9  }
      10  
      11  void test_2 (int i)
      12  {
      13    void *p = malloc (1024); /* { dg-message "allocated here" } */
      14    global_ptr = p;
      15    *(int *)&p = i;
      16    p = global_ptr;
      17    free (p);
      18    free (global_ptr); /* { dg-warning "double-'free' of 'p'" } */
      19  }