This is the mail archive of the 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: PATCH: Fix ICE in dwarf2out.c

Jeff Sturm <> writes:

> In 3.0 we cannot use "-gdwarf-2 -g1" to compile any c++/java code with
> inline members.  

Just a note, doing so is, or at least should be, pointless.
Unless your debugger can't get the symbols from the actual executable,
or something.

-g1 is equivalent in GDB to the minimal symbols, which it can get
without any debug info enabled. 
Wait, that's not quite true. It's minimal symbols with line
numbers. That's all.

Not that this means the bug isn't a bug, just trying to save you some
> This is logged as c++/2814, and here's Daniel Berlin's
> analysis:
> The ICE apparently started with Jason Merril's clone patch:
> In dwarf2out_abstract_function we emit the in-class declaration first,
> eventually confusing dwarf2out when it goes to splice and discovers the
> function is not top-level.
> In DINFO_LEVEL_TERSE or below, we avoid generating any output for types,
> variables, or just about anything but functions.  The easy fix is to
> prevent calling gen_type_die_for_member for -g1.  That survives a "make
> bootstrap" (unsurprisingly, since nothing is built with -g1).  But I have
> no idea if this is doing the right thing, this being my first attempt at
> dwarf-2 and all.
> This is a regression from 2.95.3 and ought to be fixed somehow for 3.0.
> We've had numerous bug reports since the release, mostly from alpha and
> ia64 users (whose compilers default to dwarf2 output) and gcj (which
> defaults to -g1 output for backtraces).
> 2001-07-13  Jeff Sturm  <>
> 	* dwarf2out.c (dwarf2out_abstract_function): Don't emit
> 	in-class declaration at -g1.  Fixes c++/2814.
> Index: dwarf2out.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
> retrieving revision
> diff -u -p -r1.242.2.20 dwarf2out.c
> --- dwarf2out.c	2001/06/05 21:07:46
>+++ dwarf2out.c	2001/07/13 07:36:03
> @@ -9430,10 +9430,13 @@ dwarf2out_abstract_function (decl)
>    /* Be sure we've emitted the in-class declaration DIE (if any) first, so
>       we don't get confused by DECL_ABSTRACT.  */
> -  context = decl_class_context (decl);
> -  if (context)
> -    gen_type_die_for_member
> -      (context, decl, decl_function_context (decl) ? NULL : comp_unit_die);
>+  if (debug_info_level > DINFO_LEVEL_TERSE)
>+    {
>+      context = decl_class_context (decl);
>+      if (context)
>+	gen_type_die_for_member
>+	  (context, decl, decl_function_context (decl) ? NULL : comp_unit_die);
>+    }
>    /* Pretend we've just finished compiling this function.  */
>    save_fn = current_function_decl;

This *should* work. At least, it's the right fix for this portion. I'm
sure there are other places doing similar things, but we can worry
about those later.

"I couldn't find the remote control to the remote control.
"-Steven Wright

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