1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-pre" } */
3 
4 extern void foo (char*, int);
5 extern void mysprintf (char *, char *);
6 extern void myfree (void *);
7 extern int access (char *, int);
8 extern int fopen (char *, int);
9 
10 char *
hprofStartupp(char * outputFileName,char * ctx)11 hprofStartupp (char *outputFileName, char *ctx)
12 {
13   char fileName[1000];
14   int fp;
15   mysprintf (fileName, outputFileName);
16   if (access (fileName, 1) == 0)
17     {
18       myfree (ctx);
19       return 0;
20     }
21 
22   fp = fopen (fileName, 0);
23   if (fp == 0)
24     {
25       myfree (ctx);
26       return 0;
27     }
28 
29   foo (outputFileName, fp);
30 
31   return ctx;
32 }
33 
34 /* { dg-final { scan-tree-dump-times "myfree \\(" 1 "pre"} } */
35 /* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */
36 /* { dg-final { cleanup-tree-dump "pre" } } */
37