Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_two_strs.c
blob5fb152a1420605ecca342283e1ca97bd66b19ba5
1 /* { dg-do compile } */
2 /* { dg-do run } */
4 #include <stdlib.h>
6 typedef struct
8 int a;
9 float b;
10 }str_t1;
12 typedef struct
14 int c;
15 float d;
16 }str_t2;
18 #define N 1000
20 str_t1 *p1;
21 str_t2 *p2;
22 int num;
24 void
25 foo (void)
27 int i;
29 for (i=0; i < num; i++)
30 p2[i].c = 2;
33 int
34 main ()
36 int i, r;
38 r = rand ();
39 num = r > N ? N : num;
40 p1 = malloc (num * sizeof (str_t1));
41 p2 = malloc (num * sizeof (str_t2));
43 if (p1 == NULL || p2 == NULL)
44 return 0;
46 for (i = 0; i < num; i++)
47 p1[i].a = 1;
49 foo ();
51 for (i = 0; i < num; i++)
52 if (p1[i].a != 1 || p2[i].c != 2)
53 abort ();
55 return 0;
58 /*--------------------------------------------------------------------------*/
59 /* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" } } */
60 /* { dg-final { cleanup-ipa-dump "*" } } */