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]
Other format: [Raw text]

[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 for the structure inside the asm, and when we went to add the abstract origin attribute:

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 generated.

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?

Attachment: 19345.diff
Description: Text document

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