OSDN Git Service

2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / struct / wo_prof_mult_field_peeling.c
1 /* { dg-do compile } */
2 /* { dg-do run } */
3
4 #include <stdlib.h>
5 typedef struct
6 {
7   int a;
8   float b;
9   int c;
10   float d;
11 }str_t;
12
13 #ifdef STACK_SIZE
14 #if STACK_SIZE > 1600
15 #define N 100
16 #else
17 #define N (STACK_SIZE/16)
18 #endif
19 #else
20 #define N 100
21 #endif
22
23 int 
24 main ()
25 {
26   int i;
27   str_t *p = malloc (N * sizeof (str_t));
28   if (p == NULL)
29     return 0;
30   for (i = 0; i < N; i++)
31     p[i].a = 5;
32
33   for (i = 0; i < N; i++)
34     if (p[i].a != 5)      
35       abort ();
36
37   return 0;
38 }
39
40 /*--------------------------------------------------------------------------*/
41 /* The structure str_t is erroneously peeled into 4 structures instead of 2.  */
42 /* { dg-final { scan-ipa-dump "the number of new types is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
43 /* { dg-final { cleanup-ipa-dump "*" } } */