OSDN Git Service

For Greta Yorsh.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-dce-7.c
1 /* { dg-do link } */
2 /* { dg-options "-O -fdump-tree-optimized" } */
3
4 extern void link_error (void);
5 void foo(int n)
6 {
7   int * f = (int*) __builtin_malloc (n * sizeof (int));
8   int * ff = (int*) __builtin_malloc (n * sizeof (int));
9   int i;
10
11   for (i = 0; i < n; ++i)
12     {
13       f[i] = 1;
14       ff[i] = 2;
15       if (f[i] != 1)
16         link_error ();
17       if (ff[i] != 2)
18         link_error ();
19     }
20
21   __builtin_free (f);
22   __builtin_free (ff);
23 }
24 int main()
25 {
26   return 0;
27 }
28
29 /* We should have removed the calls to link_error () and all stores
30    to the allocated memory.  */
31
32 /* { dg-final { scan-tree-dump-times "\\\*D" 0 "optimized" } } */
33 /* { dg-final { cleanup-tree-dump "optimized" } } */