aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr16194.c
diff options
context:
space:
mode:
authorJ"orn Rennecke <joern.rennecke@st.com>2006-02-09 19:17:09 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2006-02-09 19:17:09 +0000
commit91b4415af4fafcd53f44b671003e917dd7ec0cfd (patch)
tree7fcf4d414c6e351a2b6ddc6cf557386db43b8be6 /gcc/testsuite/gcc.dg/pr16194.c
parent0e692cc0bfb3d8209ee6bfe2e3467f444df860d9 (diff)
downloadgcc-91b4415af4fafcd53f44b671003e917dd7ec0cfd.zip
gcc-91b4415af4fafcd53f44b671003e917dd7ec0cfd.tar.gz
gcc-91b4415af4fafcd53f44b671003e917dd7ec0cfd.tar.bz2
re PR inline-asm/16194 (global register with inline-asm and clobered)
PR inline-asm/16194 gcc: * tree.h (decl_overlaps_hard_reg_set_p) Don't declare. (tree_overlaps_hard_reg_set): Declare. * stmt.c (decl_overlaps_hard_reg_set_p): Now static. Change return type and signature to match function type expected by walk_tree. (tree_overlaps_hard_reg_set): New function. (decl_conflicts_with_clobbers_p): Rename to: (tree_conflicts_with_clobbers_p). Take HARD_REG_SET * argument. Use tree_overlaps_hard_reg_set. Changed caller. * doc/tm.texi (TARGET_MD_ASM_CLOBBERS): Replace decl_overlaps_hard_reg_set_p with tree_overlaps_hard_reg_set. * cris.c (cris_md_asm_clobbers): Likewise. gcc/testsuite: * gcc.dg/pr16194.c: New test. From-SVN: r110810
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr16194.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr16194.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr16194.c b/gcc/testsuite/gcc.dg/pr16194.c
new file mode 100644
index 0000000..44f34a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr16194.c
@@ -0,0 +1,67 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+/* { dg-bogus "internal compiler error" "ICE" { target *-*-* } 0 } */
+
+#define ASMDECL __asm (REG);
+#define CLOBBER_LIST : REG
+#define INP_CLOBBER_LIST : CLOBBER_LIST
+#if defined (__alpha__)
+# define REG "$1"
+#elif defined (__CRIS__) || defined (__sh__)
+# define REG "r10"
+#elif defined (__i386__)
+# define REG "%eax"
+#elif defined (__MMIX__)
+# define REG "$8"
+#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
+ || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
+# define REG "6"
+#elif defined (__x86_64__)
+# define REG "rax"
+#else
+ /* Make this test harmless for any target not recognized above. */
+# undef ASMDECL
+# define ASMDECL
+# define REG "conflict"
+# undef CLOBBER_LIST
+# define CLOBBER_LIST
+# undef INP_CLOBBER_LIST
+# define INP_CLOBBER_LIST
+#endif
+
+struct A
+{
+ int a;
+};
+
+struct B
+{
+ struct A b[3];
+};
+
+struct C
+{
+ struct B c;
+};
+
+void bug (void)
+{
+ register char* dst ASMDECL;
+ __asm__ ("":"=g"(*dst): : REG); /* { dg-error "conflict" } */
+}
+
+/* The tree optimizers currently prevent us from finding an overlap -
+ we end up using a copy of dst rather than dst.
+ But at least make sure we don't get an ICE. */
+void bug2 (void)
+{
+ register char* dst ASMDECL;
+ __asm__ ("": :"g"(*dst) CLOBBER_LIST);
+}
+
+void
+foo (void)
+{
+ register struct C *dst ASMDECL;
+ __asm__ ("" : "=g"(dst->c.b[1].a) INP_CLOBBER_LIST);
+}