dwarf2out.c patch for block extern decl abort
Jim Wilson
wilson@cygnus.com
Thu Jul 27 20:46:00 GMT 2000
This continues the thread I started on gcc-bugs.
http://gcc.gnu.org/ml/gcc-bugs/2000-07/msg00702.html
After some more confused poking around, I believe I have the right fix this
time.
The call to set_decl_origin_self sets DECL_ABSTRACT_ORIGIN, which is safe
only if we have a die for this decl. However, there are cases where
gen_abstract_function decides not to emit a die. This is because it calls
dwarf2out_decl instead of gen_decl_die, and dwarf2out_decl ignores some
cases that gen_decl_die does not. Thus we must not execute this code
for decls that are ignored by dwarf2out_decl. In particular, we can't
execute this code if DECL_INITIAL (decl) == NULL_TREE.
This was tested with an x86-linux --with-dwarf2 bootstrap, a make check,
and my original testcase.
I have checked in this patch.
2000-07-27 Jim Wilson <wilson@cygnus.com>
* dwarf2out.c (gen_decl_die): Don't call gen_abstract_function if
DECL_INITIAL (decl) == NULL_TREE.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.189
diff -p -r1.189 dwarf2out.c
*** dwarf2out.c 2000/07/26 20:59:32 1.189
--- dwarf2out.c 2000/07/28 02:11:48
*************** gen_decl_die (decl, context_die)
*** 9671,9677 ****
/* If we're emitting an out-of-line copy of an inline function,
emit info for the abstract instance and set up to refer to it. */
if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
! && ! class_scope_p (context_die))
{
gen_abstract_function (decl);
set_decl_origin_self (decl);
--- 9671,9681 ----
/* If we're emitting an out-of-line copy of an inline function,
emit info for the abstract instance and set up to refer to it. */
if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
! && ! class_scope_p (context_die)
! /* gen_abstract_function won't emit a die if this is just a
! declaration. We must avoid setting DECL_ABSTRACT_ORIGIN in
! that case, because that works only if we have a die. */
! && DECL_INITIAL (decl) != NULL_TREE)
{
gen_abstract_function (decl);
set_decl_origin_self (decl);
More information about the Gcc-patches
mailing list