IRA: Ignore debug insns for uses in split_live_ranges_for_shrink_wrap. [PR116179]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / malloc-dedupe-1.c
blob233ab485b5afb37e8d3633ebaad8d22d3f9e79e1
1 #include <stdlib.h>
3 extern void foo (void);
4 extern void bar (void);
6 void test_1 (int flag, int n);
8 void caller_1_of_test_1 (int n)
10 test_1 (1, n); /* { dg-bogus "test_1" } */
11 test_1 (0, n); /* { dg-bogus "test_1" } */
14 void __attribute__((noinline))
15 test_1 (int flag, int n)
17 int *ptr = (int *)malloc (sizeof (int));
19 if (flag)
21 int i;
22 for (i = 0; i < n; i++)
23 foo ();
25 else
26 bar ();
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. */
36 if (flag)
37 foo ();
38 else
39 bar ();
42 void caller_2_of_test_1 (int n)
44 test_1 (1, n); /* { dg-bogus "test_1" } */
45 test_1 (0, n); /* { dg-bogus "test_1" } */