2012-10-29 Alexandre Oliva <aoliva@redhat.com>
+ PR debug/54693
+ * tree-ssa-threadedge.c (thread_around_empty_block): Copy
+ debug temps from predecessor before threading.
+
+2012-10-29 Alexandre Oliva <aoliva@redhat.com>
+
PR debug/54551
PR debug/54693
* valtrack.c (dead_debug_global_find): Accept NULL dtemp.
+2012-10-29 Alexandre Oliva <aoliva@redhat.com>
+
+ PR debug/54693
+ * gcc.dg/guality/pr54693.c: New.
+
2012-10-29 Marc Glisse <marc.glisse@inria.fr>
PR middle-end/55027
--- /dev/null
+/* PR debug/54693 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+__attribute__((noinline, noclone)) void
+foo (char *str, char c)
+{
+ asm volatile ("" : : "r" (str), "r" (c) : "memory");
+ *str = c;
+}
+
+int
+main ()
+{
+ int i;
+ char c;
+ char arr[11];
+
+ for (i = 0; i < 10; i++)
+ {
+ c = 0x30 + i;
+ foo (&arr[i], c); /* { dg-final { gdb-test 22 "i" "c - 48" } } */
+ }
+
+ __builtin_printf ("arr = %s\n", arr);
+ return 0;
+}
+
if (!single_pred_p (bb))
return NULL;
+ /* Before threading, copy DEBUG stmts from the predecessor, so that
+ we don't lose the bindings as we redirect the edges. */
+ if (MAY_HAVE_DEBUG_STMTS)
+ {
+ gsi = gsi_after_labels (bb);
+ for (gimple_stmt_iterator si = gsi_last_bb (taken_edge->src);
+ !gsi_end_p (si); gsi_prev (&si))
+ {
+ stmt = gsi_stmt (si);
+ if (!is_gimple_debug (stmt))
+ continue;
+
+ stmt = gimple_copy (stmt);
+ /* ??? Should we drop the location of the copy? */
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+ }
+ }
+
/* This block must have more than one successor. */
if (single_succ_p (bb))
return NULL;