This is the mail archive of the gcc-patches@gcc.gnu.org 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 23547, non unit-at-a-time and nested functions


The problem here is that we call ggc_collect during the un-nesting of
the nested functions which causes us to free the new allocated type.
Removing the ggc_collect is hard as that would mean removing it from
all the lowering passes which is not really wanted at all.  This fixes
the problem by allocating nesting_info in GC memory instead.


I tried to mark var_map as skip so we could allocate it in the heap as all of those trees would already be referenced by gengtype would not allow me too for some reason, oh well.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
I tried to bootstrap and test Ada but even without my patch, all the Ada
tests fail, this did not happen a couple of days ago though.

Thanks,
Andrew Pinski

ChangeLog:

* tree-nested.c (struct var_map_elt): Mark with GTY.
(struct nesting_info): Mark with GTY. Mark var_map's param is struct
var_map_elt.
(lookup_field_for_decl): Allocate new element in GC memory.
(lookup_tramp_for_decl): Likewise.
(convert_nl_goto_reference): Likewise
(create_nesting_tree): Allocate info in GC memory. Likewise for info->var_map.
(free_nesting_tree): Free with ggc_free instead of free.
(root): New static variable.
(lower_nested_functions): Remove root as local variable. And zero out root at
the end of the function.


testsuite/ChangeLog:
	* gcc.dg/pr23547.c: New test.


Attachment: t.diff.txt
Description: Text document


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