blob: bc7f94032cb35e704b432e9f2ff9cd8683febbcd (
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
|
/* PR rtl-optimization/23561 */
struct A
{
char a1[1];
char a2[5];
char a3[1];
char a4[2048 - 7];
} a;
typedef __SIZE_TYPE__ size_t;
extern void *memset (void *, int, size_t);
extern void *memcpy (void *, const void *, size_t);
extern int memcmp (const void *, const void *, size_t);
extern void abort (void);
void
bar (struct A *x)
{
size_t i;
if (memcmp (x, "\1HELLO\1", sizeof "\1HELLO\1"))
abort ();
for (i = 0; i < sizeof (x->a4); i++)
if (x->a4[i])
abort ();
}
int
foo (void)
{
memset (&a, 0, sizeof (a));
a.a1[0] = 1;
memcpy (a.a2, "HELLO", sizeof "HELLO");
a.a3[0] = 1;
bar (&a);
return 0;
}
int
main (void)
{
foo ();
return 0;
}
|