summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/c-c++-common/asmgoto-4.c44
-rw-r--r--gcc/testsuite/gcc.target/i386/pr44071.c103
3 files changed, 151 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8a74fd13476..ee0fab84ca2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2010-05-11 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/44071
+ * c-c++-common/asmgoto-4.c: New test.
+ * gcc.target/i386/pr44071.c: New test.
+
PR c++/44062
* c-c++-common/Wunused-var-7.c: New test.
* g++.dg/warn/Wunused-var-9.C: New test.
diff --git a/gcc/testsuite/c-c++-common/asmgoto-4.c b/gcc/testsuite/c-c++-common/asmgoto-4.c
new file mode 100644
index 00000000000..4532bf196ee
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asmgoto-4.c
@@ -0,0 +1,44 @@
+/* PR middle-end/44071 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static inline int
+f1 (void)
+{
+ asm goto ("" : : : : l1, l2);
+ __builtin_unreachable ();
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+int
+b1 (int x)
+{
+ if (f1 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+static inline int
+f2 (void)
+{
+ asm goto ("" : : : : l1, l2);
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+int
+b2 (int x)
+{
+ if (f2 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr44071.c b/gcc/testsuite/gcc.target/i386/pr44071.c
new file mode 100644
index 00000000000..514c5e2fd2c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr44071.c
@@ -0,0 +1,103 @@
+/* PR middle-end/44071 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+static inline int
+f1 (void)
+{
+ asm goto ("jmp %l[l1]" : : : : l1, l2);
+ __builtin_unreachable ();
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+__attribute__((noinline)) int
+b1 (int x)
+{
+ if (f1 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+static inline int
+f2 (void)
+{
+ asm goto ("jmp %l[l2]" : : : : l1, l2);
+ __builtin_unreachable ();
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+__attribute__((noinline)) int
+b2 (int x)
+{
+ if (f2 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+static inline int
+f3 (void)
+{
+ asm goto ("jmp %l[l1]" : : : : l1, l2);
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+__attribute__((noinline)) int
+b3 (int x)
+{
+ if (f3 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+static inline int
+f4 (void)
+{
+ asm goto ("jmp %l[l2]" : : : : l1, l2);
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+__attribute__((noinline)) int
+b4 (int x)
+{
+ if (f4 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+extern void abort (void);
+
+int
+main (void)
+{
+ int x;
+ asm ("" : "=r" (x) : "0" (0));
+ if (b1 (x) != 1 || b1 (x + 6) != 1)
+ abort ();
+ if (b2 (x) != 2 || b2 (x + 6) != 1)
+ abort ();
+ if (b3 (x) != 1 || b3 (x + 6) != 1)
+ abort ();
+ if (b4 (x) != 2 || b4 (x + 6) != 1)
+ abort ();
+ return 0;
+}