[Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 9 13:56:00 GMT 2007



------- Comment #1 from jakub at gcc dot gnu dot org  2007-11-09 13:56 -------
I have tried:
--- dwarf2out.c.jj9     2007-11-05 09:05:44.000000000 +0100
+++ dwarf2out.c 2007-11-09 14:29:04.000000000 +0100
@@ -11032,6 +11032,26 @@ add_bound_info (dw_die_ref subrange_die,
           later parameter.  */
        if (decl_die != NULL)
          add_AT_die_ref (subrange_die, bound_attr, decl_die);
+       /* Handle gimplified type bounds.  */
+        else if (TREE_CODE (bound) == VAR_DECL
+                && DECL_ARTIFICIAL (bound)
+                && !DECL_NAME (bound)
+                && !TREE_STATIC (bound)
+                && current_function_decl
+                && (lookup_decl_loc (bound)
+                    || loc_descriptor_from_tree (bound)))
+         {
+           dw_die_ref ctx, decl_die;
+
+           ctx = lookup_decl_die (current_function_decl);
+
+           decl_die = new_die (DW_TAG_variable, ctx, bound);
+           add_AT_flag (decl_die, DW_AT_artificial, 1);
+           add_type_attribute (decl_die, TREE_TYPE (bound), 1, 0, ctx);
+           add_location_or_const_value_attribute (decl_die, bound,
+                                                  DW_AT_location);
+           add_AT_die_ref (subrange_die, bound_attr, decl_die);
+         }
        break;
       }

but that still doesn't work, because instantiate_decl etc. hasn't been called
on this, only BLOCK_VARS are treated that way.  So, either we need to put these
artificial vars into BLOCK_VARS, or find a way to also keep the original
non-gimplified expression in TYPE_DOMAIN.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34037



More information about the Gcc-bugs mailing list