OSDN Git Service

PR debug/45259
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Aug 2010 09:04:48 +0000 (09:04 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Aug 2010 09:04:48 +0000 (09:04 +0000)
* caller-save.c (save_call_clobbered_regs): Only swap notes with
DEBUG_INSNs if n_regs_saved.

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

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

gcc/ChangeLog
gcc/caller-save.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr45259.c [new file with mode: 0644]

index d55ddbe..fff6268 100644 (file)
@@ -1,3 +1,9 @@
+2010-08-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/45259
+       * caller-save.c (save_call_clobbered_regs): Only swap notes with
+       DEBUG_INSNs if n_regs_saved.
+
 2010-08-12  Wei Guozhi  <carrot@google.com>
 
        PR target/44999
index 446da51..9ca8592 100644 (file)
@@ -868,7 +868,10 @@ save_call_clobbered_regs (void)
             remain saved.  If the last insn in the block is a JUMP_INSN, put
             the restore before the insn, otherwise, put it after the insn.  */
 
-         if (DEBUG_INSN_P (insn) && last && last->block == chain->block)
+         if (n_regs_saved
+             && DEBUG_INSN_P (insn)
+             && last
+             && last->block == chain->block)
            {
              rtx ins, prev;
              basic_block bb = BLOCK_FOR_INSN (insn);
index 6ac7bba..84bd311 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/45259
+       * gcc.dg/pr45259.c: New test.
+
 2010-08-12  Wei Guozhi  <carrot@google.com>
 
        PR target/44999
diff --git a/gcc/testsuite/gcc.dg/pr45259.c b/gcc/testsuite/gcc.dg/pr45259.c
new file mode 100644 (file)
index 0000000..b8dc365
--- /dev/null
@@ -0,0 +1,42 @@
+/* PR debug/45259 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2 -fpic -w" { target fpic } } */
+
+struct S { void (*bar) (long); };
+struct T { struct S *t; };
+int w;
+extern int baz (int);
+
+void
+foo (int x, int u, char *z)
+{
+  struct T *v;
+  static void *y[256] = { &&l1, &&l2 };
+  for (;;)
+    switch (x)
+      {
+      l2:
+       x = 9;
+      case 9:
+       goto *y[*z++];
+      case 10:
+      case 27:
+      case 54:
+      case 99:
+      case 100:
+      case 120:
+      case 122:
+      case 131:
+      case 132:
+      case 134:
+      case 141:
+      case 142:
+       v->t->bar (u);
+       v->t->bar (u);
+      case 143:
+       continue;
+      l1:
+      default:
+       baz (w);
+      }
+}