1 /* { dg-additional-options "-fanalyzer-verbosity=3" } */
2
3 #include <stdio.h>
4
5 extern int foo ();
6 extern void bar ();
7
test(const char * path,int flag)8 void test (const char *path, int flag)
9 {
10 FILE *fp = fopen (path, "r"); /* { dg-message "opened here" } */
11
12 /* We should report this control flow at -fanalyzer-verbosity=3. */
13 if (foo ()) /* { dg-message "branch" } */
14 bar ();
15 else
16 bar ();
17
18 if (flag) /* { dg-message "when 'flag == 0'" } */
19 fclose (fp);
20 } /* { dg-warning "leak of FILE 'fp'" } */
21