OSDN Git Service

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