aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/data-model-10.c
blob: 04c9891d89bd38ed3f3f36af788c031e25006297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdlib.h>

struct foo
{
  char **m_f;
};

struct foo *
test (void)
{
  struct foo *new_table = (struct foo *) malloc(sizeof(struct foo));
  if (!new_table)
    return NULL;
  new_table->m_f = (char **)malloc(sizeof(char **));
  *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '\\*new_table.m_f'" } */
  /* { dg-message "'\\*new_table.m_f' could be NULL" "final event wording" { target *-*-* } .-1 } */
  return new_table;
}