]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c
re PR middle-end/42834 (memcpy folding overeager)
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_global_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 str_t *p;
22
23 int
24 main ()
25 {
26 int i, sum;
27
28 p = malloc (N * sizeof (str_t));
29 if (p == NULL)
30 return 0;
31 for (i = 0; i < N; i++)
32 p[i].b = i;
33
34 for (i = 0; i < N; i++)
35 p[i].b = p[i].a + 1;
36
37 for (i = 0; i < N; i++)
38 if (p[i].b != p[i].a + 1)
39 abort ();
40
41 return 0;
42 }
43
44 /*--------------------------------------------------------------------------*/
45 /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
46 /* { dg-final { cleanup-ipa-dump "*" } } */