aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr43864.c
blob: 8d1e989fb18ddc51746da5c88e4e79d2781fb105 (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
36
/* { 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 { scan-tree-dump-not "Invalid sum" "pre"} } */
/* { dg-final { cleanup-tree-dump "pre" } } */