From 3516ced06bb1724663ce4a9bfd58e306482546ac Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 28 Oct 2004 18:28:10 +0000 Subject: [PATCH] [taken from gcc-2.96] 2001-02-07 Alexandre Oliva * dwarf2out.c (gen_subprogram_die): Don't call add_abstract_origin_attribute if lookup_decl_die is NULL. 2001-02-07 Jakub Jelinek * gcc.dg/20010207-1.c: New test. git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9606 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- gcc/gcc/dwarf2out.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/gcc/dwarf2out.c b/gcc/gcc/dwarf2out.c index 7ce80506fd..3fd0f7b820 100644 --- a/gcc/gcc/dwarf2out.c +++ b/gcc/gcc/dwarf2out.c @@ -8359,7 +8359,16 @@ gen_subprogram_die (decl, context_die) if (origin != NULL) { subr_die = new_die (DW_TAG_subprogram, context_die); - add_abstract_origin_attribute (subr_die, origin); + /* lookup_decl_die (origin) may be NULL if decl is a copy of an + implicit declaration of a function that was created while + inlining a function that referenced the function without a + prior declaration. Since we don't emit such implicit + declarations in the first place, there's no point in linking + this copy to it. Besides, add_abstract_origin_attribute() + would crash. */ + if (TREE_CODE (origin) != FUNCTION_DECL + || lookup_decl_die (origin)) + add_abstract_origin_attribute (subr_die, origin); } else if (old_die && DECL_ABSTRACT (decl) && get_AT_unsigned (old_die, DW_AT_inline))