https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71689
Bug ID: 71689 Summary: Missing dwarf info when using nested function Product: gcc Version: 4.8.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: asnast at gmail dot com Target Milestone: --- Hello, The following piece of code will fail to correctly generate dwarf function signature information: void outer(int *x) { *x *= 2; void inner(void) { *x += 1; } } int main() { return 0; } When compiling with "gcc -g <filename>" a DW_TAG_formal_parameter DIE is not generated for 'x' parameter for outer function above: dwarfdump -a ./a.out: LOCAL_SYMBOLS: < 1><0x0000002d> DW_TAG_subprogram DW_AT_external yes(1) DW_AT_name "outter" DW_AT_decl_file 0x00000001 /home/alexsn/tst.c DW_AT_decl_line 0x00000001 DW_AT_prototyped yes(1) DW_AT_low_pc 0x00400566 DW_AT_high_pc <offset-from-lowpc>68 DW_AT_frame_base len 0x0001: 9c: DW_OP_call_frame_cfa DW_AT_GNU_all_tail_call_sitesyes(1) DW_AT_sibling <0x0000005e> < 2><0x0000004a> DW_TAG_subprogram ... Note that this only occurs if 'x' parameter if used from both outer and inner function and removing either will correctly generate the missing DIE: void outer(int *x) { void inner(void) { *x += 1; } } or void outer(int *x) { *x *= 2; void inner(void) { } } Will generate: LOCAL_SYMBOLS: < 1><0x0000002d> DW_TAG_subprogram DW_AT_external yes(1) DW_AT_name "outter" DW_AT_decl_file 0x00000001 /home/alexsn/tst.c DW_AT_decl_line 0x00000001 DW_AT_prototyped yes(1) DW_AT_low_pc 0x00400566 DW_AT_high_pc <offset-from-lowpc>58 DW_AT_frame_base len 0x0001: 9c: DW_OP_call_frame_cfa DW_AT_GNU_all_tail_call_sitesyes(1) DW_AT_sibling <0x0000005e> < 2><0x0000004a> DW_TAG_formal_parameter DW_AT_name "x" DW_AT_decl_file 0x00000001 /home/alexsn/tst.c DW_AT_decl_line 0x00000001 DW_AT_type <0x0000005e> I've tested this on gcc 4.8.4 and gcc 5.3.1 both of which havethis issue. Thanks, Alex.