re PR debug/45003 (VTA issues with sign/zero extension and debug temporaries)
authorJakub Jelinek <jakub@redhat.com>
Tue, 20 Jul 2010 12:58:03 +0000 (14:58 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 20 Jul 2010 12:58:03 +0000 (14:58 +0200)
PR debug/45003
* cfgexpand.c (expand_debug_expr) <case NOP_EXPR>: Use ZERO_EXTEND
or SIGN_EXTEND depending on TYPE_UNSIGNED of the operand's type
instead of the result's type.

* gcc.dg/guality/pr45003-1.c: New test.

From-SVN: r162336

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/guality/pr45003-1.c [new file with mode: 0644]

index 2065af693faf2d26cb200e11921869aadef4898c..f7598eb8d1ddec089db6fd3c91b38b70b05d517d 100644 (file)
@@ -1,3 +1,10 @@
+2010-07-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/45003
+       * cfgexpand.c (expand_debug_expr) <case NOP_EXPR>: Use ZERO_EXTEND
+       or SIGN_EXTEND depending on TYPE_UNSIGNED of the operand's type
+       instead of the result's type.
+
 2010-07-20  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/44977
index d8378ee14b6891a1e3539b607a98f8a712f85edf..3d7bdd0f81d6f4d4bd408e07066218e172c0b40b 100644 (file)
@@ -2427,7 +2427,7 @@ expand_debug_expr (tree exp)
          op0 = simplify_gen_subreg (mode, op0, inner_mode,
                                     subreg_lowpart_offset (mode,
                                                            inner_mode));
-       else if (unsignedp)
+       else if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))))
          op0 = gen_rtx_ZERO_EXTEND (mode, op0);
        else
          op0 = gen_rtx_SIGN_EXTEND (mode, op0);
index ae38e84e348f1bad6d52bfb364cf377ae4ac5b99..391d88f0a7691fd73b066419bb31c81cddfc9795 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/45003
+       * gcc.dg/guality/pr45003-1.c: New test.
+
 2010-07-20  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/44977
diff --git a/gcc/testsuite/gcc.dg/guality/pr45003-1.c b/gcc/testsuite/gcc.dg/guality/pr45003-1.c
new file mode 100644 (file)
index 0000000..7cef8f6
--- /dev/null
@@ -0,0 +1,31 @@
+/* PR debug/45003 */
+/* { dg-do run { target { x86_64-*-* && lp64 } } } */
+/* { dg-options "-g" } */
+
+int __attribute__((noinline))
+foo (unsigned short *p)
+{
+  int a = *p;
+  asm volatile ("nop");
+  asm volatile ("nop" : : "D" (a));    /* { dg-final { gdb-test 10 "a" "0x8078" } } */
+  return 0;
+}
+
+int __attribute__((noinline))
+bar (short *p)
+{
+  unsigned int a = *p;
+  asm volatile ("nop");
+  asm volatile ("nop" : : "D" (a));    /* { dg-final { gdb-test 19 "a" "0xffff8078" } } */
+  return 0;
+}
+
+int
+main ()
+{
+  unsigned short us = 0x8078;
+  foo (&us);
+  short s = -32648;
+  bar (&s);
+  return 0;
+}