1 /* Tests for precision-of-wording within malloc warnings. */
3 typedef __SIZE_TYPE__
size_t;
4 extern void *malloc(size_t);
5 extern void free(void *);
6 extern char *strcpy(char *__restrict __dest
, const char *__restrict __src
)
7 __attribute__((__nothrow__
, __leaf__
)) __attribute__((__nonnull__(1, 2)));
11 void *p
= malloc (1024); /* { dg-message "\\(1\\) this call could return NULL" } */
12 strcpy ((char *)p
, "hello world"); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
13 /* { dg-message "\\(2\\) argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "event" { target *-*-* } .-1 } */
19 int *i
= malloc (sizeof (int)); /* { dg-message "\\(1\\) this call could return NULL" } */
20 *i
= 42; /* { dg-warning "dereference of possibly-NULL 'i'" "warning" } */
21 /* { dg-message "\\(2\\) 'i' could be NULL: unchecked value from \\(1\\)" "event" { target *-*-* } .-1 } */