aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/fd-leak-pr108252.c
blob: 29f58d361c1ce450e43065d79fc0f38aab33c0e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extern int open(const char *, int mode);
#define O_RDONLY 0

struct {
  int fd_a;
  int fd_b;
} g;

int test (const char *path, int flag)
{
  int *target;
  target = flag ? &g.fd_a : &g.fd_b;
  *target = open (path, O_RDONLY);  
  return 0; /* { dg-bogus "leak of file descriptor" } */
}