This is the mail archive of the
mailing list for the GCC project.
[PATCH] Fix PR debug/19345
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 26 Jan 2005 22:28:47 -0500 (EST)
- Subject: [PATCH] Fix PR debug/19345
Now that we actually exercise our debug info functions more, we are
starting to hit corner cases and expose a few latent bugs.
In this case, a 4.0 regression, we were trying to generate the inlined
structure type die
structure inside the asm, and when we went to add the abstract origin
1. we fall into the TREE_CODE (origin) != FUNCTION_DECL portion, because
gen_inlined_structure_type_die always passes in the type as the origin.
2. We get TYPE_STUB_DECL (origin) because origin is a RECORD_TYPE.
3. TYPE_STUB_DECL (origin) is NULL.
4. We pass null to decl_function_context.
5. decl_function_context dereferences it, and we blow up.
This means we never could have been trying to generate debug info for this
inlined structure type before, since i didn't touch this code path, and
this didn't fail in 3.4.
Compiling with 3.4 confirms this. There is no inlined structure type die
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?
Description: Text document