1 typedef __SIZE_TYPE__
size_t;
2 #include "../../gcc.dg/analyzer/analyzer-decls.h"
5 strlen(const char* __s
) __attribute__((__nothrow__
, __leaf__
))
6 __attribute__((__pure__
)) __attribute__((__nonnull__(1)));
9 malloc(size_t __size
) __attribute__((__nothrow__
, __leaf__
))
10 __attribute__((__malloc__
)) __attribute__((__alloc_size__(1)));
13 sprintf(char* __restrict __s
, const char* __restrict
, ...)
14 __attribute__((__nothrow__
));
17 test_1 (const char *a
, const char *b
)
19 size_t sz
= strlen (a
) + strlen (b
) + 2;
20 char *p
= (char *) malloc (sz
);
23 sprintf (p
, "%s/%s", a
, b
);
28 test_2 (const char *a
, const char *b
)
30 size_t sz
= strlen (a
) + strlen (b
) + 2;
31 char *p
= (char *) malloc (sz
); /* { dg-message "allocated here" } */
34 sprintf (p
, "%s/%s", a
, b
); /* { dg-warning "leak of 'p' " } */