re PR debug/42800 (VLA DW_AT_upper_bound is no longer emitted)
authorJason Merrill <jason@redhat.com>
Tue, 23 Feb 2010 18:32:09 +0000 (13:32 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 23 Feb 2010 18:32:09 +0000 (13:32 -0500)
PR debug/42800
* cfgexpand.c (expand_used_vars): Keep artificial non-ignored vars
in cfun->local_decls even if they have register types.

From-SVN: r157014

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/dwarf2/vla1.c [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp

index b148e67d11df7c95aa4db00efc79f81ce726e0e3..0361b40677d399f92d7fdd8e20929d7a098e15c7 100644 (file)
@@ -1,5 +1,9 @@
 2010-02-23  Jason Merrill  <jason@redhat.com>
 
+       PR debug/42800
+       * cfgexpand.c (expand_used_vars): Keep artificial non-ignored vars
+       in cfun->local_decls even if they have register types.
+
        PR c++/42837
        * stor-layout.c (place_field): Don't warn about unnecessary
        DECL_PACKED if the type is packed.
index d9b5774c006afcc2f5e9659f82bee5de19f05068..f5677a3c1ee6bbbdff0af67dc406554ee816eb36 100644 (file)
@@ -1331,8 +1331,7 @@ expand_used_vars (void)
       if (is_gimple_reg (var))
        {
          TREE_USED (var) = 0;
-         ggc_free (t);
-         continue;
+         goto next;
        }
       /* We didn't set a block for static or extern because it's hard
         to tell the difference between a global variable (re)declared
@@ -1353,20 +1352,20 @@ expand_used_vars (void)
       TREE_USED (var) = 1;
 
       if (expand_now)
+       expand_one_var (var, true, true);
+
+    next:
+      if (DECL_ARTIFICIAL (var) && !DECL_IGNORED_P (var))
        {
-         expand_one_var (var, true, true);
-         if (DECL_ARTIFICIAL (var) && !DECL_IGNORED_P (var))
-           {
-             rtx rtl = DECL_RTL_IF_SET (var);
+         rtx rtl = DECL_RTL_IF_SET (var);
 
-             /* Keep artificial non-ignored vars in cfun->local_decls
-                chain until instantiate_decls.  */
-             if (rtl && (MEM_P (rtl) || GET_CODE (rtl) == CONCAT))
-               {
-                 TREE_CHAIN (t) = cfun->local_decls;
-                 cfun->local_decls = t;
-                 continue;
-               }
+         /* Keep artificial non-ignored vars in cfun->local_decls
+            chain until instantiate_decls.  */
+         if (rtl && (MEM_P (rtl) || GET_CODE (rtl) == CONCAT))
+           {
+             TREE_CHAIN (t) = cfun->local_decls;
+             cfun->local_decls = t;
+             continue;
            }
        }
 
index ee078d143686b1fb6606eebe7a6180aa262da8e4..7fe352009aa8719a4897b65c481c778d69ca44b3 100644 (file)
@@ -1,3 +1,10 @@
+2010-02-23  Jason Merrill  <jason@redhat.com>
+
+       PR debug/42800
+       * gcc.dg/debug/dwarf2/dwarf2.exp: Run c-c++-common dwarf2 tests.
+       * g++.dg/debug/dwarf2/dwarf2.exp: Likewise.
+       * c-c++-common/dwarf2/vla1.c: New.
+
 2010-02-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/43139
@@ -12,7 +19,7 @@
        * gcc.dg/march.c: New.
        * gcc.dg/march-generic.c: New.
        * gcc.dg/mtune.c: New.
-       
+
 2010-02-22  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/43083
diff --git a/gcc/testsuite/c-c++-common/dwarf2/vla1.c b/gcc/testsuite/c-c++-common/dwarf2/vla1.c
new file mode 100644 (file)
index 0000000..e814bf5
--- /dev/null
@@ -0,0 +1,11 @@
+// PR debug/42800
+// { dg-options "-gdwarf-2 -dA" }
+// { dg-final { scan-assembler "DW_AT_upper_bound" } }
+
+int
+f (int i)
+{
+  char a[i];
+
+  return a[0];
+}
index 1255d0630e750f56b395602a284496e6e8c2b3e3..1a874f8db49c890e164df59b49e477df7b3707ce 100644 (file)
@@ -35,7 +35,7 @@ set comp_output [g++_target_compile \
 if { ! [string match "*: target system does not support the * debug format*" \
     $comp_output] } {
     remove-build-file "trivial.S"
-    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[C\]]] \
+    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/dwarf2/*.c]] \
            "" $DEFAULT_CFLAGS
 }
 
index 73c2c44aebdfa413b6d340b41cab5047259de5f1..74136aec353e39f56db5c9d2408efe33460b41f3 100644 (file)
@@ -35,7 +35,7 @@ set comp_output [gcc_target_compile \
 if { ! [string match "*: target system does not support the * debug format*" \
     $comp_output] } {
     remove-build-file "trivial.S"
-    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\] $srcdir/c-c++-common/dwarf2/*.c]] \
            "" $DEFAULT_CFLAGS
 }