------- Comment #7 from ebotcazou at gcc dot gnu dot org 2007-03-21 09:31 ------- > If I understand right the two patches do different things. Consider > the following example: > > void X(void) { > void D(void) { D(); }; > D(); > } > > The nested function is reachable, so presumably your patch doesn't > change the behaviour of tree-nested in this case, i.e. D gets a > static chain even though it doesn't need one. My patch makes sure > that D doesn't get a static chain.
Indeed, we still unnecessarily build a static chain for D. Your solution seems to be somewhat complex though. Can't we get away with an iterative propagation algorithm for the DECL_NO_STATIC_CHAIN flag? > By the way, I see that you added a hash table for going from the > context to the nesting_info. I was too lazy to do that, instead > I do a linear list walk to find it. Do you think it matters? No real idea in practice, but we try to avoid potentially quadratic stuff in the compiler as a general policy. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30927