re PR debug/19192 (Current development gcc generates inaccurate line info for example code)

PR debug/19192
	PR debug/43479
	* cfgexpand.c (gimple_assign_rhs_to_tree): Also set TREE_BLOCK
	from gimple_block.
	* expr.c (expand_expr_real): Restore previous
	curr_insn_source_location and curr_insn_block after
	expand_expr_real_1 call.
	(expand_expr_real_1) <case SSA_NAME>: Call expand_expr_real
	instead of expand_expr_real_1.

	* gcc.dg/guality/pr43479.c: New test.
	* gcc.dg/debug/dwarf2/inline2.c (third): Make a a global var
	and add volatile keyword.

From-SVN: r157693
This commit is contained in:
Jakub Jelinek 2010-03-24 14:41:30 +01:00 committed by Jakub Jelinek
parent 012cd3b6b5
commit d0ed412a96
6 changed files with 68 additions and 5 deletions

View File

@ -1,3 +1,15 @@
2010-03-24 Jakub Jelinek <jakub@redhat.com>
PR debug/19192
PR debug/43479
* cfgexpand.c (gimple_assign_rhs_to_tree): Also set TREE_BLOCK
from gimple_block.
* expr.c (expand_expr_real): Restore previous
curr_insn_source_location and curr_insn_block after
expand_expr_real_1 call.
(expand_expr_real_1) <case SSA_NAME>: Call expand_expr_real
instead of expand_expr_real_1.
2010-03-23 Mike Stump <mikestump@comcast.net>
PR target/33120

View File

@ -77,8 +77,12 @@ gimple_assign_rhs_to_tree (gimple stmt)
{
t = gimple_assign_rhs1 (stmt);
/* Avoid modifying this tree in place below. */
if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (t)
&& gimple_location (stmt) != EXPR_LOCATION (t))
if ((gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (t)
&& gimple_location (stmt) != EXPR_LOCATION (t))
|| (gimple_block (stmt)
&& currently_expanding_to_rtl
&& EXPR_P (t)
&& gimple_block (stmt) != TREE_BLOCK (t)))
t = copy_node (t);
}
else
@ -86,6 +90,8 @@ gimple_assign_rhs_to_tree (gimple stmt)
if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (t))
SET_EXPR_LOCATION (t, gimple_location (stmt));
if (gimple_block (stmt) && currently_expanding_to_rtl && EXPR_P (t))
TREE_BLOCK (t) = gimple_block (stmt);
return t;
}

View File

@ -7176,6 +7176,8 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
if (cfun && EXPR_HAS_LOCATION (exp))
{
location_t saved_location = input_location;
location_t saved_curr_loc = get_curr_insn_source_location ();
tree saved_block = get_curr_insn_block ();
input_location = EXPR_LOCATION (exp);
set_curr_insn_source_location (input_location);
@ -7185,6 +7187,8 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl);
input_location = saved_location;
set_curr_insn_block (saved_block);
set_curr_insn_source_location (saved_curr_loc);
}
else
{
@ -8409,8 +8413,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{
gimple g = get_gimple_for_ssa_name (exp);
if (g)
return expand_expr_real_1 (gimple_assign_rhs_to_tree (g), target,
tmode, modifier, NULL);
return expand_expr_real (gimple_assign_rhs_to_tree (g), target,
tmode, modifier, NULL);
}
decl_rtl = get_rtx_for_ssa_name (exp);
exp = SSA_NAME_VAR (exp);

View File

@ -1,3 +1,11 @@
2010-03-24 Jakub Jelinek <jakub@redhat.com>
PR debug/19192
PR debug/43479
* gcc.dg/guality/pr43479.c: New test.
* gcc.dg/debug/dwarf2/inline2.c (third): Make a a global var
and add volatile keyword.
2010-03-23 Mike Stump <mikestump@comcast.net>
* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Enhance portability.

View File

@ -36,12 +36,12 @@
actually inlined. */
/* { dg-final { scan-assembler-times "(?:byte|data1)\[^\n\]*0x3\[^\n\]* DW_AT_inline" 3 } } */
volatile int *a;
inline void
third (int arg3)
{
int var3 = arg3;
int* a = 0;
a[0] = var3;
}

View File

@ -0,0 +1,33 @@
/* PR debug/43479 */
/* { dg-do run } */
/* { dg-options "-g" } */
__attribute__((noinline)) void
foo (int k, int l, int m, int n)
{
l++;
{
int h = n;
{
int i = k;
k++; /* { dg-final { gdb-test 13 "i" "6" } } */
} /* { dg-final { gdb-test 13 "h" "9" } } */
/* { dg-final { gdb-test 13 "n" "9" } } */
{
int j = m;
m++; /* { dg-final { gdb-test 18 "j" "8" } } */
} /* { dg-final { gdb-test 18 "h" "9" } } */
/* { dg-final { gdb-test 12 "n" "9" } } */
}
asm volatile ("" : : "r" (k), "r" (l));
asm volatile ("" : : "r" (m), "r" (n));
}
int
main (void)
{
int q = 6;
asm ("" : "+r" (q));
foo (q, q + 1, q + 2, q + 3);
return 0;
}