wo_prof_escape_substr_value.c: Limit allocation based on STACK_SIZE.
[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
28 main (void)
29 {
30 int i;
31 str_with_substr_t A[N];
32 str_t a[N];
33
34 for (i=0; i < N; i++)
35 A[i].sub_str = &(a[i]);
36
37 for (i=0; i < N; i++)
38 A[i].sub_str->a = 5;
39
40 return 0;
41 }
42
43 /*--------------------------------------------------------------------------*/
44 /* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
45 /* { dg-final { cleanup-ipa-dump "*" } } */