Remove 'bool' special-casing from dwarf2out_decl

Message ID alpine.LNX.2.00.1009211434160.8982@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Sept. 21, 2010, 12:39 p.m.
When re-testing lazy building of comp_unit_die I noticed that
g++.dg/debug/dwarf2/typedef4.C starts to fail.  Which is because
with that patch we now emit a DIE for 'bool'.  The funny thing
is that we didn't do so before because the C++ FE calls
debug_hooks->type_decl via

#0  dwarf2out_decl (decl=0x7ffff7edea10)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:20931
#1  0x000000000091d1ab in dwarf2out_type_decl (decl=0x7ffff7edea10, 
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:20794
#2  0x00000000004e796f in record_builtin_type (rid_index=RID_INT, 
    type=0x7ffff7ee8498) at 
#3  0x00000000007b6308 in c_common_nodes_and_builtins ()
    at /space/rguenther/src/svn/trunk/gcc/c-family/c-common.c:4483
#4  0x00000000004e7fd9 in cxx_init_decl_processing ()
    at /space/rguenther/src/svn/trunk/gcc/cp/decl.c:3436
#5  0x000000000063b970 in cxx_init ()
    at /space/rguenther/src/svn/trunk/gcc/cp/lex.c:252
#6  0x0000000000c50284 in lang_dependent_init (
at /space/rguenther/src/svn/trunk/gcc/toplev.c:2262
#7  0x0000000000c504b0 in do_compile ()
    at /space/rguenther/src/svn/trunk/gcc/toplev.c:2393

which happens before(!) debug_hooks->init is called.  Which of
course leaves comp_unit_die NULL and thus is_cxx () return false.


So to avoid regressing g++.dg/debug/dwarf2/typedef4.C this patch
removes that bool special-case as it obviously didn't work anyways
if bool wasn't used in the TU.

What to do with the above initialization order problem I have no idea
(maybe move debug_hooks->init before lang_hooks.init ()?).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Ok for trunk?


2010-09-21  Richard Guenther  <>

	* dwarf2out.c (dwarf2out_decl): Do not always generate a DIE
	for bool for C++.


Index: gcc/dwarf2out.c
--- gcc/dwarf2out.c.orig	2010-09-21 14:33:34.000000000 +0200
+++ gcc/dwarf2out.c	2010-09-21 14:33:04.000000000 +0200
@@ -21019,20 +21019,6 @@  dwarf2out_decl (tree decl)
       if (TYPE_DECL_SUPPRESS_DEBUG (decl))
-      /* Don't bother trying to generate any DIEs to represent any of the
-	 normal built-in types for the language we are compiling.  */
-      if (DECL_IS_BUILTIN (decl))
-	{
-	  /* OK, we need to generate one for `bool' so GDB knows what type
-	     comparisons have.  */
-	  if (is_cxx ()
-	      && TREE_CODE (TREE_TYPE (decl)) == BOOLEAN_TYPE
-	      && ! DECL_IGNORED_P (decl))
-	    modified_type_die (TREE_TYPE (decl), 0, 0, NULL);
-	  return;
-	}
       /* If we are in terse mode, don't generate any DIEs for types.  */
       if (debug_info_level <= DINFO_LEVEL_TERSE)