aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wdangling-pointer-pr106868.c
blob: f782a5e07a12cafbf8fb6e51ccb7764b2bc14d72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* { dg-do compile } */
/* { dg-options "-O -Wdangling-pointer" } */

void alloc(void **p);
void false_dangling(char **p)
{
  {
    void *q;
    alloc(&q);
    *p = q;
  }
  char *a = __builtin_memcpy(*p, "", 1);
  *a = 0; /* { dg-bogus "dangling" } */
}