PR debug/49544
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Jun 2011 16:45:49 +0000 (16:45 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Jun 2011 16:45:49 +0000 (16:45 +0000)
* cselib.c (promote_debug_loc): If cselib_preserve_constants
and l has two DEBUG_INSN owned locs instead of just one, adjust
the second location's setting_insn too.

* gcc.dg/pr49544.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175540 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cselib.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr49544.c [new file with mode: 0644]

index 9d3823a..14e023b 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/49544
+       * cselib.c (promote_debug_loc): If cselib_preserve_constants
+       and l has two DEBUG_INSN owned locs instead of just one, adjust
+       the second location's setting_insn too.
+
 2011-06-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR libmudflap/38738
index e575aff..b96c0cd 100644 (file)
@@ -257,7 +257,15 @@ promote_debug_loc (struct elt_loc_list *l)
     {
       n_debug_values--;
       l->setting_insn = cselib_current_insn;
-      gcc_assert (!l->next || cselib_preserve_constants);
+      if (cselib_preserve_constants && l->next)
+       {
+         gcc_assert (l->next->setting_insn
+                     && DEBUG_INSN_P (l->next->setting_insn)
+                     && !l->next->next);
+         l->next->setting_insn = cselib_current_insn;
+       }
+      else
+       gcc_assert (!l->next);
     }
 }
 
index 7184340..2d026a0 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/49544
+       * gcc.dg/pr49544.c: New test.
+
 2011-06-27  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/49394
diff --git a/gcc/testsuite/gcc.dg/pr49544.c b/gcc/testsuite/gcc.dg/pr49544.c
new file mode 100644 (file)
index 0000000..65498f4
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR debug/49544 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+
+int baz (int, int, void *);
+
+static inline __attribute__ ((always_inline)) long
+foo (int x, int y, void *z)
+{
+  if (y < 0)
+    return baz (x, y, z);
+  return 0;
+}
+
+long
+bar (long x, long y, long z)
+{
+  return foo (x, y, (void *) z);
+}