aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wdangling-pointer-4.c
blob: 36c8da5113a8338affd94d6b06cd5845daed20c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR middle-end/104761 - bogus -Wdangling-pointer with cleanup and infinite loop
   { dg-do compile }
   { dg-options "-O -Wall" } */

typedef struct { int i; } S;

void f (S **);

int g (int);

void nowarn (int x)
{
  S s = { 0 };

  __attribute__((__cleanup__ (f))) S *p = 0;

  if (x)
    {
      g (s.i);                // { dg-bogus "-Wdangling-pointer" }
      for ( ; ; );
    }
}