This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR debug/19345
On Wed, 26 Jan 2005, Mark Mitchell wrote:
Daniel Berlin wrote:
Rather than add a null check in decl_function_context, i've simply guarded
against calling it here with null (we already were assuming it could
return null, so what's 2 null checks when you've already got 1 :P).
Everything else DTRT once we exit our if block.
Bootstrapped and regtested on i686-pc-linux-gnu. Okay for mainline?
That doesn't seem right to me, as this type is indeed local to a function.
I'd say that DECL_CONTEXT applied to the type should indeed be a
FUNCTION_DECL.
It is.
See dwarf2out.c add_abstract_origin_attribute
The if part this code is in is just trying to make sure the containing
function got written out (which is actually already should have now that
we do it in cgraph, but i didn't want to play with this already fragile
code for 4.0).
So it's just fine if it can't find one.
It has nothing to do with looking up the "context" of the original type,
that is done a few lines later.
That means that either TYPE_STUB_DECL should be non-NULL
(probably),
tree.h's docs on TYPE_STUB_DECL gives me the distinct impression that
TYPE_STUB_DECL is optional, and may be NULL.