1 /* PR middle-end/57748 */
2 /* { dg-do run } */
3 /* ICE in expand_assignment:
4    misalignp == true, !MEM_P (to_rtx), offset != 0,
5    => gcc_assert (TREE_CODE (offset) == INTEGER_CST) */
6 
7 #include <stdlib.h>
8 
9 extern void abort (void);
10 
11 typedef long long V
12   __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
13 
14 typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
15 
16 struct __attribute__((packed)) T { char c; P s; };
17 
18 void __attribute__((noinline, noclone))
check(struct T * t)19 check (struct T *t)
20 {
21   if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
22     abort ();
23 }
24 
25 int __attribute__((noinline, noclone))
get_i(void)26 get_i (void)
27 {
28   return 0;
29 }
30 
31 void __attribute__((noinline, noclone))
foo(P * p)32 foo (P *p)
33 {
34   V a = { 3, 4 };
35   int i = get_i ();
36   p->b[i] = a;
37 }
38 
39 int
main()40 main ()
41 {
42   struct T *t = (struct T *) calloc (128, 1);
43 
44   foo (&t->s);
45   check (t);
46 
47   free (t);
48   return 0;
49 }
50