From: jakub Date: Wed, 24 Mar 2010 13:41:30 +0000 (+0000) Subject: PR debug/19192 X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=dfecf957a06c647768ef1edf7e4b6f642d70c24f 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) : 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157693 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d5f1a568a2..62aef06388f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2010-03-24 Jakub Jelinek + + 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) : Call expand_expr_real + instead of expand_expr_real_1. + 2010-03-23 Mike Stump PR target/33120 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index fcae897a392..a797af9a167 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -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; } diff --git a/gcc/expr.c b/gcc/expr.c index 1e74f2a6911..ad66d934d2f 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 63432cf94d2..81510249632 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2010-03-24 Jakub Jelinek + + 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 * g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Enhance portability. diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c index 641712bf26f..06d1b59c3b1 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c @@ -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; } diff --git a/gcc/testsuite/gcc.dg/guality/pr43479.c b/gcc/testsuite/gcc.dg/guality/pr43479.c new file mode 100644 index 00000000000..e0bc246cdae --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr43479.c @@ -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; +}