re PR middle-end/42834 (memcpy folding overeager)
[platform/upstream/gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_escape_substr_pointer.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 > 16000
13 #define N 1000
14 #else
15 #define N (STACK_SIZE/16)
16 #endif
17 #else
18 #define N 1000
19 #endif
20
21 typedef struct 
22 {
23   str_t * sub_str;
24   int c;
25 }str_with_substr_t;
26
27 int foo;
28
29 int
30 main (void)
31 {
32   int i;
33   str_with_substr_t A[N];
34   str_t a[N];
35
36   for (i=0; i < N; i++)
37     A[i].sub_str = &(a[i]);
38
39   for (i=0; i < N; i++)
40     A[i].sub_str->a = 5;
41
42   foo = A[56].sub_str->a;
43
44   return 0;
45 }
46
47 /*--------------------------------------------------------------------------*/
48 /* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
49 /* { dg-final { cleanup-ipa-dump "*" } } */