Patchwork Remove 'bool' special-casing from dwarf2out_decl

login
register
mail settings
Submitter Richard Guenther
Date Sept. 21, 2010, 12:49 p.m.
Message ID <alpine.LNX.2.00.1009211449270.8982@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/65305/
State New
Headers show

Comments

Richard Guenther - Sept. 21, 2010, 12:49 p.m.
On Tue, 21 Sep 2010, Richard Guenther wrote:

> 
> 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, 
> local=0)
>     at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:20794
> #2  0x00000000004e796f in record_builtin_type (rid_index=RID_INT, 
> name=0x0, 
>     type=0x7ffff7ee8498) at 
> /space/rguenther/src/svn/trunk/gcc/cp/decl.c:3280
> #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 (
>     name=0x7fffffffe15b 
> "/space/rguenther/src/svn/trunk/gcc/testsuite/g++.dg/debug/dwarf2/typedef4.C") 
> 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.
> 
> Huh.
> 
> 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?

Err - wrong patch sent.  Correct variant below.

Richard.

2010-09-21  Richard Guenther  <rguenther@suse.de>

	* dwarf2out.c (dwarf2out_decl): Do not always generate a DIE
	for bool for C++.
Jason Merrill - Sept. 21, 2010, 3:06 p.m.
OK.

Jason

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c.orig	2010-09-21 14:48:26.000000000 +0200
+++ gcc/dwarf2out.c	2010-09-21 14:48:16.000000000 +0200
@@ -21022,16 +21022,7 @@  dwarf2out_decl (tree 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;
-	}
+	return;
 
       /* If we are in terse mode, don't generate any DIEs for types.  */
       if (debug_info_level <= DINFO_LEVEL_TERSE)