https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78835
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 17 Jan 2017, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78835 > > --- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > (In reply to Richard Biener from comment #10) > > (In reply to Jakub Jelinek from comment #9) > > > Created attachment 40524 [details] > > > gcc7-pr78835.patch > > > > > > Untested patch that fixes the ICE on this testcase by marking directly > > > called functions as needed. Will see what will it do with the size of the > > > debug info. > > > Of course, it is not sufficient, with -fdebug-types-section we can still > > > ICE > > > unless the earlier patch is also applied 9or some more sophisticated one > > > to > > > construct skeleton DIEs if type inside of type unit is detected). > > > > I think this is a reasonable approach (plus the hunk from comment#1 of > > course). > > For the above patch (sans #c1) I've bootstrapped/regtested it last night, and > compared to gcc without the patch the growth of the debug info is small and > IMHO acceptable. On cc1plus on x86_64 comparing build without the patch and > with the patch (in the former I've applied the patch and did make in stage3 > dir, so that it is the same source) .debug_info size grew by 0.009% and in > libstdc++.so.6 by 0.29%. > > > But we can't really create new skeleton DIEs after early-finish because with > > LTO we do not have access to enough information to build type DIEs. > > I think it is possible, e.g. considering > namespace A { inline namespace B { namespace C { struct D { struct Bar { void > Baz (); int i; }; }; > } } int vvv = 17; } > A::C::D::Bar b; > void Foo (A::C::D::Bar &t) { t.Baz (); } > to create > .uleb128 0x2 # (DIE (0x25) DW_TAG_namespace) > .ascii "A\0" # DW_AT_name > # DW_AT_declaration > .uleb128 0x3 # (DIE (0x2c) DW_TAG_namespace) > .ascii "B\0" # DW_AT_name > # DW_AT_declaration > .uleb128 0x3 # (DIE (0x2f) DW_TAG_namespace) > .ascii "C\0" # DW_AT_name > # DW_AT_declaration > .uleb128 0xa # (DIE (0x32) DW_TAG_structure_type) > .ascii "D\0" # DW_AT_name > # DW_AT_declaration > .uleb128 0x4 # (DIE (0x35) DW_TAG_structure_type) > .ascii "Bar\0" # DW_AT_name > # DW_AT_declaration > .byte 0xf0 # DW_AT_signature > .byte 0x8 > .byte 0x56 > .byte 0xd4 > .byte 0x2d > .byte 0xa7 > .byte 0x74 > .byte 0x7c > .uleb128 0x8 # (DIE (0x5c) DW_TAG_subprogram) > # DW_AT_external > # DW_AT_declaration > .ascii "Baz\0" # DW_AT_name In the end the great plan(TM) is to no longer have the TREE_TYPEs/DECLs of the contexts around during GIMPLE optimizations ... I think -fdebug-types-section always creates the skeletons so we may choose to just never remove those as unused? > Where the DW_AT_signature would actually point to the .debug_types signature > and therefore the full declaration. But I'm not going to work on that right > now, so would prefer for now just #c9 + #c1 + testcase. Yes, that's reasonable.