OSDN Git Service

* cfgexpand.c (expand_debug_expr): Fail if bitpos < 0 for non-MEM
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Oct 2009 07:39:43 +0000 (07:39 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Oct 2009 07:39:43 +0000 (07:39 +0000)
op0.

* gcc.dg/debug/vta-3.c: New test.

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

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/vta-3.c [new file with mode: 0644]

index 706052d..a8f7148 100644 (file)
@@ -1,4 +1,9 @@
-2009-10-17  Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+2009-10-19  Jakub Jelinek  <jakub@redhat.com>
+
+       * cfgexpand.c (expand_debug_expr): Fail if bitpos < 0 for non-MEM
+       op0.
+
+2009-10-17  Andy Hutchinson  <hutchinsonandy@gcc.gnu.org>
 
        PR middle-end/41738
        * optabs.c (expand_binop): Make mode of shift count expression mode
index acd70c1..8c7c881 100644 (file)
@@ -2593,6 +2593,9 @@ expand_debug_expr (tree exp)
        if (bitpos == 0 && mode == GET_MODE (op0))
          return op0;
 
+        if (bitpos < 0)
+          return NULL;
+
        if ((bitpos % BITS_PER_UNIT) == 0
            && bitsize == GET_MODE_BITSIZE (mode1))
          {
index 168123f..d4d4652 100644 (file)
@@ -1,3 +1,7 @@
+2009-10-19  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/debug/vta-3.c: New test.
+
 2009-10-17  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/nested_proc.adb: Rename into...
diff --git a/gcc/testsuite/gcc.dg/debug/vta-3.c b/gcc/testsuite/gcc.dg/debug/vta-3.c
new file mode 100644 (file)
index 0000000..7d014f1
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+int
+foo (void)
+{
+  union { char e[8]; int i; } a, b;
+  char *c, *d;
+  unsigned int i;
+  c = a.e;
+  d = &b.e[sizeof (int) - 1];
+  for (i = 0; i < sizeof (int); i++)
+    {
+      *d = *c++;
+      --d;
+    }
+  return b.i;
+}