(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
data-model-9.c
       1  #include <stdlib.h>
       2  #include <string.h>
       3  #include "analyzer-decls.h"
       4  
       5  struct foo
       6  {
       7    int i;
       8  };
       9  
      10  /* TODO: verify that we know that calloc zeros its memory.  */
      11  
      12  void test_1 (void)
      13  {
      14    struct foo *f = calloc (1, sizeof (struct foo));
      15    if (f == NULL)
      16      return;
      17    __analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
      18    /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
      19    free (f);
      20  }
      21  
      22  /* TODO: verify that we know the behavior of memset.  */
      23  
      24  void test_2 (void)
      25  {
      26    struct foo *f = malloc (sizeof (struct foo));
      27    if (f == NULL)
      28      return;
      29    memset (f, 0, sizeof (struct foo));
      30    __analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
      31    /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
      32    free (f);
      33  }