This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Ensure DW_TAG_base_type has DW_AT_name (PR debug/42278)


On Tue, May 11, 2010 at 02:44:28PM -0400, Jason Merrill wrote:
> On 05/11/2010 01:34 PM, Jakub Jelinek wrote:
> >+  if (qualified_type == sizetype
> >+      && TYPE_NAME (qualified_type)
> >+      && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL
> >+      && TREE_CODE (TREE_TYPE (TYPE_NAME (qualified_type))) == INTEGER_TYPE
> >+      && TYPE_PRECISION (TREE_TYPE (TYPE_NAME (qualified_type)))
> >+	 == TYPE_PRECISION (qualified_type)
> >+      && TYPE_UNSIGNED (TREE_TYPE (TYPE_NAME (qualified_type)))
> >+	 == TYPE_UNSIGNED (qualified_type))
> >+    qualified_type = TREE_TYPE (TYPE_NAME (qualified_type));
> 
> Is this level of checking really necessary?  Does any front end have
> a TYPE_DECL for TYPE_NAME (sizetype) with an incompatible TREE_TYPE?
> I'd rather make the later tests an assert.

I think the TYPE_PRECISION check might be necessary, at least set_sizetype
has some code to change precision from the base type.
And, it seems many frontends have NULL TYPE_NAME on sizetype, or
it is an identifier, not a TYPE_DECL.

Would you be ok with just doing the == INTEGER_TYPE and == TYPE_UNSIGNED
checks in gcc_assert?

> >+  else if (name && mod_type_die->die_tag == DW_TAG_base_type)
> >+    add_name_attribute (mod_type_die, "__unknown__");
> 
> Why check 'name' here?
> 
> I would think this could replace the "__unknown__" code in
> base_type_die, but please bring over the comment that this probably
> indicates a bug.

The check was just to avoid adding it if base_type_die has already
added it.  Removing the add_name_attribute call in base_type_die
and moving over the command (and removing "name && " above) is possible too.
BTW, it seems there is another call to base_type_die in 
dwarf2out_imported_module_or_decl_1:
      if (is_base_type (TREE_TYPE (decl)))
        at_import_die = base_type_die (TREE_TYPE (decl));
      else
        at_import_die = force_type_die (TREE_TYPE (decl));

I guess that's another problem - that DW_TAG_base_type will be without
DW_AT_name too.  This has been added for PR29906.
Will need to try that why force_type_die doesn't handle the base types...

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]