(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
calloc-1.c
       1  #include "analyzer-decls.h"
       2  
       3  typedef __SIZE_TYPE__ size_t;
       4  
       5  #define NULL ((void *)0)
       6  
       7  extern void *calloc (size_t __nmemb, size_t __size)
       8    __attribute__ ((__nothrow__ , __leaf__))
       9    __attribute__ ((__malloc__))
      10    __attribute__ ((__alloc_size__ (1, 2))) ;
      11  
      12  char *test_1 (size_t sz)
      13  {
      14    char *p;
      15  
      16    p = calloc (1, 3);
      17    if (!p)
      18      return NULL;
      19  
      20    __analyzer_dump_capacity (p); /* { dg-warning "capacity: '\\(\[^\n\r\]*\\)3'" } */
      21  
      22    __analyzer_eval (p[0] == 0); /* { dg-warning "TRUE" } */
      23    __analyzer_eval (p[1] == 0); /* { dg-warning "TRUE" } */
      24    __analyzer_eval (p[2] == 0); /* { dg-warning "TRUE" } */
      25  
      26    return p;
      27  }