This is the mail archive of the gcc-bugs@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]

Re: debug/2813: Type of variable is wrong in dwarf2 debugging info


   >Description:
   Compiling the attached test with -gdwarf-2 -dA, we find DW_AT_type
   of variable lave points at the DW_TAG_const_type die constructed
   for the argument cc, instead of pointing directly to the
   DW_TAG_base_type that represents type char.

   This is a regression from GCC 2.95.2.

This patch is the culprit:

2001-04-11  Mark Mitchell  <mark@codesourcery.com>

	* dwarf2out.c (modified_type_die): Don't create new types here.
	* tree.h (get_qualified_type): New function.
	(build_qualified_type): Adjust comment.
	* tree.c (get_qualified_type): New function.
	(build_qualified_type): Use it.

Basically, what's happening is that when creating a DIE for a
qualified type, the code attaches the newly created DIE to the
origional unqualified type:

  equate_type_number_to_die (type, mod_type_die);

Thereafter the DIE for the qualified type will be used whenever an
unqualified type is seen.

I'm not sure how to solve this elegantly.  Adding

  if (qualified_type)
    type = qualified_type

at the end of the

  if (code != ERROR_MARK)
    {

block should do the trick, but perhaps a more experienced GCC hacker
can come up with a better idea.

Hope this helps,

Mark


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