* [PATCH] Fix declare_vars (PR debug/37726)
@ 2008-10-03 19:27 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2008-10-03 19:27 UTC (permalink / raw)
To: gcc-patches
Hi!
Before tuples conversion declare_vars was using BIND_EXPR_BLOCK to
get BLOCK, which maps to gimple_bind_block, not gimple_block.
Typically scope is the outermost GIMPLE_BIND of a function and so
gimple_block (scope) is typically NULL, while gimple_bind_block is not.
This bug causes DECL_HAS_VALUE_EXPR_P vars created during nested pass
for debugging purposes not be emitted in BLOCK_VARS, which means
nothing is emitted in the debug info.
Bootstrapped/regtested on x86_64-linux, committed to trunk.
2008-10-03 Jakub Jelinek <jakub@redhat.com>
PR debug/37726
* gimplify.c (declare_vars): Use gimple_bind_block instead of
gimple_block.
* gcc.dg/debug/dwarf2/pr37726.c: New test.
--- gcc/gimplify.c.jj 2008-09-18 17:12:45.000000000 +0200
+++ gcc/gimplify.c 2008-10-03 16:33:40.000000000 +0200
@@ -772,7 +772,7 @@ declare_vars (tree vars, gimple scope, b
temps = nreverse (last);
- block = gimple_block (scope);
+ block = gimple_bind_block (scope);
gcc_assert (!block || TREE_CODE (block) == BLOCK);
if (!block || !debug_info)
{
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c.jj 2008-10-03 16:43:28.000000000 +0200
+++ gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c 2008-10-03 16:48:26.000000000 +0200
@@ -0,0 +1,25 @@
+/* PR debug/37726 */
+/* { dg-do compile } */
+/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */
+
+int foo (int parm)
+{
+ int var = 0;
+ int bar (void)
+ {
+ return parm + var;
+ }
+ parm++;
+ var++;
+ return bar ();
+}
+
+int
+main (void)
+{
+ return foo (4) - 6;
+}
+
+/* Both parm and var variables should be in debug info for both foo and bar. */
+/* { dg-final { scan-assembler-times "\"parm\[^\n\]*\"\[^\n\]*DW_AT_name" 2 } } */
+/* { dg-final { scan-assembler-times "\"var\[^\n\]*\"\[^\n\]*DW_AT_name" 2 } } */
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-03 19:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-03 19:27 [PATCH] Fix declare_vars (PR debug/37726) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).