(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
pr99716-2.c
       1  /* Reduced from
       2     https://github.com/libguestfs/libguestfs/blob/e0a11061035d47b118c95706240bcc17fd576edc/tests/mount-local/test-parallel-mount-local.c#L299-L335
       3     which is GPLv2 or later.  */
       4  
       5  #include <stdio.h>
       6  #include <stdlib.h>
       7  
       8  extern int foo (void);
       9  
      10  void
      11  test_mountpoint (const char *mp)
      12  {
      13    const int nr_passes = 5 + (rand () & 31);
      14    int pass;
      15    int ret = 1;
      16    FILE *fp;
      17  
      18    for (pass = 0; pass < nr_passes; ++pass) {
      19      if (foo ()) {
      20        goto error;
      21      }
      22      fp = fopen ("file", "w");
      23      if (fp == NULL) {
      24        goto error;
      25      }
      26      fprintf (fp, "hello world\n");
      27      fclose (fp); /* { dg-bogus "double 'fclose'" } */
      28    }
      29  
      30    ret = 0;
      31  
      32   error:
      33    exit (ret);
      34  }