blob: e9de98c3b8a9b7736712be7453a41609a7d7c69a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include <stdlib.h>
typedef struct
{
int a;
float b;
}str_t1;
typedef struct
{
int c;
float d;
}str_t2;
#ifdef STACK_SIZE
#if STACK_SIZE > 16000
#define N 1000
#else
#define N (STACK_SIZE/16)
#endif
#else
#define N 1000
#endif
str_t1 *p1;
str_t2 *p2;
int num;
void
foo (void)
{
int i;
for (i=0; i < num; i++)
p2[i].c = 2;
}
int
main ()
{
int i, r;
r = rand ();
num = r > N ? N : r;
p1 = malloc (num * sizeof (str_t1));
p2 = malloc (num * sizeof (str_t2));
if (p1 == NULL || p2 == NULL)
return 0;
for (i = 0; i < num; i++)
p1[i].a = 1;
foo ();
for (i = 0; i < num; i++)
if (p1[i].a != 1 || p2[i].c != 2)
abort ();
return 0;
}
/*--------------------------------------------------------------------------*/
/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
|