summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c
new file mode 100644
index 000000000..1d60a3013
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre" } */
+
+int foo (int i, int j, int b)
+{
+ int res = 0;
+ if (b)
+ res = i/j;
+ /* We should insert the possibly trapping i/j. */
+ res += i/j;
+ return res;
+}
+
+extern void bar (void);
+int foo2 (int i, int j, int b)
+{
+ int res = 0;
+ if (b)
+ res = i/j;
+ /* But we fail so here because of the possibly not returning
+ call in the same basic-block. */
+ res += i/j;
+ bar ();
+ return res;
+}
+
+/* { dg-final { scan-tree-dump-times "# prephitmp" 1 "pre" } } */
+/* { dg-final { scan-tree-dump-times "# prephitmp" 2 "pre" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */