1 /* { dg-additional-options "-fno-analyzer-suppress-followups" } */
3 #include "../../gcc.dg/analyzer/analyzer-decls.h"
5 typedef __SIZE_TYPE__
size_t;
8 extern void *malloc (size_t __size
)
9 __attribute__ ((__nothrow__
, __leaf__
))
10 __attribute__ ((__malloc__
))
11 __attribute__ ((__alloc_size__ (1)));
12 extern void *realloc (void *__ptr
, size_t __size
)
13 __attribute__ ((__nothrow__
, __leaf__
))
14 __attribute__ ((__warn_unused_result__
))
15 __attribute__ ((__alloc_size__ (2)));
16 extern void free (void *__ptr
)
17 __attribute__ ((__nothrow__
, __leaf__
));
18 extern void *memset (void *__ptr
, int __value
, size_t __size
);
20 /* realloc where the region shrinks on success_with_move. */
24 char *p
= (char *) malloc (16);
29 char *q
= (char *) realloc (p
, 8);
37 __analyzer_dump_capacity (q
); /* { dg-warning "capacity: '\\(\[^\n\r\]*\\)8'" } */
38 __analyzer_eval (q
[8] == 1); /* { dg-line eval } */
40 /* { dg-warning "UNKNOWN" "warning" { target *-*-* } eval } */
41 /* { dg-warning "heap-based buffer over-read" "warning" { target *-*-* } eval } */