Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/data-model-10.c

raw
1 #include <stdlib.h>
2
3 struct foo
4 {
5 char **m_f;
6 };
7
8 struct foo *
9 test (void)
10 {
11 struct foo *new_table = (struct foo *) malloc(sizeof(struct foo));
12 if (!new_table)
13 return NULL;
14 new_table->m_f = (char **)malloc(sizeof(char **));
15 *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '\\*new_table.m_f'" } */
16 /* { dg-message "'\\*new_table.m_f' could be NULL" "final event wording" { target *-*-* } .-1 } */
17 return new_table;
18 }