2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_malloc_size_var.c
blob7e80baba7d8a9ce964e313862c6e6c285000242e
1 /* { dg-do compile } */
2 /* { dg-do run } */
4 #include <stdlib.h>
5 typedef struct
7 int a;
8 float b;
9 }str_t;
11 #define N 1000
13 int
14 main ()
16 int i, num;
18 num = rand();
19 str_t * p = malloc (num * sizeof (str_t));
21 if (p == 0)
22 return 0;
24 for (i = 0; i < N; i++)
25 p[i].b = i;
27 for (i = 0; i < N; i++)
28 p[i].a = p[i].b + 1;
30 for (i = 0; i < N; i++)
31 if (p[i].a != p[i].b + 1)
32 abort ();
34 return 0;
37 /*--------------------------------------------------------------------------*/
38 /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
39 /* { dg-final { cleanup-ipa-dump "*" } } */