diff --git a/gcc/gimple-loop-jam.c b/gcc/gimple-loop-jam.c
index 611d38053040da0977450a0887ca32e215f2a7e8..666f740f86d79d64dbece2e40481d0d41f641340 100644
--- a/gcc/gimple-loop-jam.c
+++ b/gcc/gimple-loop-jam.c
@@ -593,7 +593,7 @@ tree_loop_unroll_and_jam (void)
 	  todo |= TODO_cleanup_cfg;
 
 	  auto_bitmap exit_bbs;
-	  bitmap_set_bit (exit_bbs, single_dom_exit (outer)->dest->index);
+	  bitmap_set_bit (exit_bbs, single_exit (outer)->dest->index);
 	  todo |= do_rpo_vn (cfun, loop_preheader_edge (outer), exit_bbs);
 	}
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr103219.c b/gcc/testsuite/gcc.dg/torture/pr103219.c
new file mode 100644
index 0000000000000000000000000000000000000000..cb9023ed8b61c3a372b6e07df8b1f951bf5a81eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr103219.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+int f();
+void g();
+int a, b, c, e;
+int d[10];
+int main()
+{
+  if (c)
+    if (f())
+      {
+	g();
+	if (e) {
+	    a = 0;
+	    for (; a != 6; a = a + 2)
+	      {
+		b = 0;
+		for (; b <= 3; b++)
+		  d[b] &= 1;
+	      }
+	}
+      }
+  return 0;
+}