re PR middle-end/42834 (memcpy folding overeager)
[platform/upstream/gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_local_var.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 }str_t;
10
11 #ifdef STACK_SIZE
12 #if STACK_SIZE > 8000
13 #define N 1000
14 #else
15 #define N (STACK_SIZE/8)
16 #endif
17 #else
18 #define N 1000
19 #endif
20
21 int
22 main ()
23 {
24   int i, sum;
25
26   str_t * p = malloc (N * sizeof (str_t));
27   if (p == NULL)
28     return 0;
29   for (i = 0; i < N; i++)
30     p[i].b = i;
31
32   for (i = 0; i < N; i++)
33     p[i].b = p[i].a + 1;
34
35   for (i = 0; i < N; i++)
36     if (p[i].b != p[i].a + 1)
37       abort ();
38
39   return 0;
40 }
41
42 /*--------------------------------------------------------------------------*/
43 /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
44 /* { dg-final { cleanup-ipa-dump "*" } } */