1 /* { dg-do compile } */
2 /* { dg-options "-O" } */
3 /* { dg-bogus "internal compiler error" "ICE" { target *-*-* } 0 } */
4 
5 #undef SKIP
6 #define ASMDECL __asm (REG);
7 #define CLOBBER_LIST : REG
8 #define INP_CLOBBER_LIST : CLOBBER_LIST
9 #if defined (__alpha__)
10 # define REG "$1"
11 #elif defined (__CRIS__) || defined (__sh__)
12 # define REG "r10"
13 #elif defined (__hppa__)
14 # define REG "%r10"
15 #elif defined (__i386__)
16 # define REG "%eax"
17 #elif defined (__MMIX__)
18 # define REG "$8"
19 #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
20         || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
21 # define REG "6"
22 #elif defined (__x86_64__)
23 # define REG "rax"
24 #elif defined (__m68k__)
25 # define REG "%d0"
26 #else
27 /* Make this test harmless for any target not recognized above.  */
28 # define SKIP 1
29 #endif
30 
31 #ifndef SKIP
32 
33 struct A
34 {
35   int a;
36 };
37 
38 struct B
39 {
40   struct A b[3];
41 };
42 
43 struct C
44 {
45   struct B c;
46 };
47 
bug(void)48 void bug (void)
49 {
50   register char* dst ASMDECL;
51   __asm__ ("":"=g"(*dst): : REG);
52 }
53 
54 /* The tree optimizers currently prevent us from finding an overlap -
55    we end up using a copy of dst rather than dst.
56    But at least make sure we don't get an ICE.  */
bug2(void)57 void bug2 (void)
58 {
59   register char* dst ASMDECL;
60   __asm__ ("": :"g"(*dst) CLOBBER_LIST);
61 }
62 
63 void
foo(void)64 foo (void)
65 {
66   register struct C *dst ASMDECL;
67   __asm__ ("" : "=g"(dst->c.b[1].a) INP_CLOBBER_LIST);
68 }
69 
70 #else
71 
main()72 int main ()
73 {
74   return 0;
75 }
76 
77 #endif
78 
79