aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-05-06 11:27:29 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-05-06 11:27:29 +0000
commit0107dca2adf82db79c54d6da9707035533d474d6 (patch)
tree08393bb2ffe3daf1347d560e6951600839f91db7 /gcc/testsuite
parente5123d087ed24066c03c97c92a15d255c8d318dd (diff)
downloadgcc-0107dca2adf82db79c54d6da9707035533d474d6.zip
gcc-0107dca2adf82db79c54d6da9707035533d474d6.tar.gz
gcc-0107dca2adf82db79c54d6da9707035533d474d6.tar.bz2
re PR middle-end/57147 (setjmp call and if body wrongly elided (function runs off early end))
2013-05-06 Richard Biener <rguenther@suse.de> PR middle-end/57147 * tree-cfg.c (gimple_purge_dead_abnormal_call_edges): If the edge is also fallthru, preserve it and just clear the abnormal flag. * tree-cfgcleanup.c (remove_fallthru_edge): If the edge is also complex, preserve that and just clear the fallthru flag. * tree-inline.c (update_ssa_across_abnormal_edges): Also update virtual operands. * gcc.dg/torture/pr57147-1.c: New testcase. * gcc.dg/torture/pr57147-2.c: Likewise. * gcc.dg/torture/pr57147-3.c: Likewise. From-SVN: r198625
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57147-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57147-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57147-3.c20
4 files changed, 70 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 745ed0dc..b4e0479 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-06 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/57147
+ * gcc.dg/torture/pr57147-1.c: New testcase.
+ * gcc.dg/torture/pr57147-2.c: Likewise.
+ * gcc.dg/torture/pr57147-3.c: Likewise.
+
2013-05-06 Oleg Endo <olegendo@gcc.gnu.org>
PR target/55303
diff --git a/gcc/testsuite/gcc.dg/torture/pr57147-1.c b/gcc/testsuite/gcc.dg/torture/pr57147-1.c
new file mode 100644
index 0000000..e5ad544
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr57147-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+struct __jmp_buf_tag {};
+typedef struct __jmp_buf_tag jmp_buf[1];
+extern int _setjmp (struct __jmp_buf_tag __env[1]);
+
+jmp_buf g_return_jmp_buf;
+
+void SetNaClSwitchExpectations (void)
+{
+}
+void TestSyscall(void)
+{
+ SetNaClSwitchExpectations();
+ _setjmp (g_return_jmp_buf);
+}
+
+/* { dg-final { scan-tree-dump-not "builtin_unreachable" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr57147-2.c b/gcc/testsuite/gcc.dg/torture/pr57147-2.c
new file mode 100644
index 0000000..521d126
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr57147-2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
+
+struct __jmp_buf_tag {};
+typedef struct __jmp_buf_tag jmp_buf[1];
+extern int _setjmp (struct __jmp_buf_tag __env[1]);
+
+jmp_buf g_return_jmp_buf;
+
+void SetNaClSwitchExpectations (void)
+{
+ __builtin_longjmp (g_return_jmp_buf, 1);
+}
+void TestSyscall(void)
+{
+ SetNaClSwitchExpectations();
+ _setjmp (g_return_jmp_buf);
+}
+
+/* { dg-final { scan-tree-dump "setjmp" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr57147-3.c b/gcc/testsuite/gcc.dg/torture/pr57147-3.c
new file mode 100644
index 0000000..c64e5ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr57147-3.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+typedef char * ptr_t;
+struct __jmp_buf_tag {
+};
+typedef struct __jmp_buf_tag sigjmp_buf[1];
+sigjmp_buf GC_jmp_buf;
+void GC_fault_handler(int sig)
+{
+}
+void GC_setup_temporary_fault_handler() {
+ GC_set_and_save_fault_handler(GC_fault_handler);
+}
+ptr_t GC_find_limit(ptr_t p)
+{
+ GC_setup_temporary_fault_handler();
+ if (__sigsetjmp (GC_jmp_buf, 1) == 0)
+ for (;;)
+ ;
+}