re PR debug/45003 (VTA issues with sign/zero extension and debug temporaries)

PR debug/45003
	* var-tracking.c (reverse_op): Also handle {SIGN,ZERO}_EXTEND of
	a MEM.
	* dwarf2out.c (loc_descriptor): Don't handle SIGN_EXTEND nor
	ZERO_EXTEND here.

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

From-SVN: r162364
This commit is contained in:
Jakub Jelinek 2010-07-21 10:50:57 +02:00 committed by Jakub Jelinek
parent a431e91330
commit 370ae5992f
6 changed files with 80 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2010-07-21 Jakub Jelinek <jakub@redhat.com>
PR debug/45003
* var-tracking.c (reverse_op): Also handle {SIGN,ZERO}_EXTEND of
a MEM.
* dwarf2out.c (loc_descriptor): Don't handle SIGN_EXTEND nor
ZERO_EXTEND here.
2010-07-20 Richard Henderson <rth@redhat.com>
* vxworks.c (vxworks_emutls_var_fields): Pass locus to build_decls.

View File

@ -14254,11 +14254,6 @@ loc_descriptor (rtx rtl, enum machine_mode mode,
loc_result = reg_loc_descriptor (rtl, initialized);
break;
case SIGN_EXTEND:
case ZERO_EXTEND:
loc_result = loc_descriptor (XEXP (rtl, 0), mode, initialized);
break;
case MEM:
loc_result = mem_loc_descriptor (XEXP (rtl, 0), GET_MODE (rtl),
initialized);

View File

@ -2,6 +2,10 @@
* gcc.dg/guality/asm-1.c: New test.
PR debug/45003
* gcc.dg/guality/pr45003-2.c: New test.
* gcc.dg/guality/pr45003-3.c: New test.
2010-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/44697

View File

@ -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" : : "D" ((int) *p));
asm volatile ("nop" : : "D" ((int) *p)); /* { dg-final { gdb-test 10 "a" "0x8078" } } */
return 0;
}
int __attribute__((noinline))
bar (short *p)
{
unsigned int a = *p;
asm volatile ("nop" : : "D" ((unsigned int) *p));
asm volatile ("nop" : : "D" ((unsigned int) *p)); /* { dg-final { gdb-test 19 "a" "0xffff8078" } } */
return 0;
}
int
main ()
{
unsigned short us = 0x8078;
foo (&us);
short s = -32648;
bar (&s);
return 0;
}

View File

@ -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 = (short) *p;
asm volatile ("nop" : : "D" ((int) *p));
asm volatile ("nop" : : "D" ((int) *p)); /* { dg-final { gdb-test 10 "a" "-32648" } } */
return 0;
}
int __attribute__((noinline))
bar (short *p)
{
unsigned int a = (unsigned short) *p;
asm volatile ("nop" : : "D" ((unsigned int) *p));
asm volatile ("nop" : : "D" ((unsigned int) *p)); /* { dg-final { gdb-test 19 "a" "0x8078" } } */
return 0;
}
int
main ()
{
unsigned short us = 0x8078;
foo (&us);
short s = -32648;
bar (&s);
return 0;
}

View File

@ -5187,16 +5187,19 @@ reverse_op (rtx val, const_rtx expr)
case XOR:
case NOT:
case NEG:
if (!REG_P (XEXP (src, 0)))
return NULL_RTX;
break;
case SIGN_EXTEND:
case ZERO_EXTEND:
if (!REG_P (XEXP (src, 0)) && !MEM_P (XEXP (src, 0)))
return NULL_RTX;
break;
default:
return NULL_RTX;
}
if (!REG_P (XEXP (src, 0))
|| !SCALAR_INT_MODE_P (GET_MODE (src))
|| XEXP (src, 0) == cfa_base_rtx)
if (!SCALAR_INT_MODE_P (GET_MODE (src)) || XEXP (src, 0) == cfa_base_rtx)
return NULL_RTX;
v = cselib_lookup (XEXP (src, 0), GET_MODE (XEXP (src, 0)), 0);