Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_two_strs.c
blob92da94d29239df51ebc80178c6b6fc27c270b471
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 #ifdef STACK_SIZE
19 #if STACK_SIZE > 16000
20 #define N 1000
21 #else
22 #define N (STACK_SIZE/16)
23 #endif
24 #else
25 #define N 1000
26 #endif
28 str_t1 *p1;
29 str_t2 *p2;
30 int num;
32 void
33 foo (void)
35 int i;
37 for (i=0; i < num; i++)
38 p2[i].c = 2;
41 int
42 main ()
44 int i, r;
46 r = rand ();
47 num = r > N ? N : r;
48 p1 = malloc (num * sizeof (str_t1));
49 p2 = malloc (num * sizeof (str_t2));
51 if (p1 == NULL || p2 == NULL)
52 return 0;
54 for (i = 0; i < num; i++)
55 p1[i].a = 1;
57 foo ();
59 for (i = 0; i < num; i++)
60 if (p1[i].a != 1 || p2[i].c != 2)
61 abort ();
63 return 0;
66 /*--------------------------------------------------------------------------*/
67 /* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
68 /* { dg-final { cleanup-ipa-dump "*" } } */