1  #include <stdlib.h>
       2  
       3  extern void foo (void);
       4  extern void bar (void);
       5  
       6  void test_1 (int flag, int n);
       7  
       8  void caller_1_of_test_1 (int n)
       9  {
      10    test_1 (1, n); /* { dg-bogus "test_1" } */
      11    test_1 (0, n); /* { dg-bogus "test_1" } */
      12  }
      13  
      14  void __attribute__((noinline))
      15  test_1 (int flag, int n)
      16  {
      17    int *ptr = (int *)malloc (sizeof (int));
      18  
      19    if (flag)
      20      {
      21        int i;
      22        for (i = 0; i < n; i++)
      23  	foo ();
      24      }
      25    else
      26      bar ();
      27  
      28    free (ptr);
      29    free (ptr); /* { dg-warning "double-'free'" } */
      30    /* FIXME: we get duplicates intraprocedurally, as there are two paths
      31       through the function.
      32       The calls in test_2 also generate additional duplicates.
      33       How to verify lack of duplicates?
      34       Putting a bogus on the interprocedual one detects that, at least.  */
      35  
      36    if (flag)
      37      foo ();
      38    else
      39      bar ();
      40  }
      41  
      42  void caller_2_of_test_1 (int n)
      43  {
      44    test_1 (1, n); /* { dg-bogus "test_1" } */
      45    test_1 (0, n); /* { dg-bogus "test_1" } */
      46  }