summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr43864.c
blob: 03c2d49c0fc1b6b35b7614f187f19fdb5a46221b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre" } */

extern void foo (char*, int);
extern void mysprintf (char *, char *);
extern void myfree (void *);
extern int access (char *, int);
extern int fopen (char *, int);

char *
hprofStartupp (char *outputFileName, char *ctx)
{
  char fileName[1000];
  int fp;
  mysprintf (fileName, outputFileName);
  if (access (fileName, 1) == 0)
    {
      myfree (ctx);
      return 0;
    }

  fp = fopen (fileName, 0);
  if (fp == 0)
    {
      myfree (ctx);
      return 0;
    }

  foo (outputFileName, fp);

  return ctx;
}

/* { dg-final { scan-tree-dump-times "myfree \\(" 1 "pre"} } */
/* { dg-final { cleanup-tree-dump "pre" } } */