On Thu, Oct 27, 2016 at 12:45:25PM -0700, Steve Kargl wrote: > Thanks for the detailed analysis. The patch looks ok to me. > I would prefer functional and cosmetic changes to be committed > separately, but in this case the cosmetic changes are small. > > > + { > > + std::swap (ns, gfc_current_ns); > > + gfc_free_namespace (ns); > > + return m; > > + } > > Not being C++ literate. I assume that the above is essential > > tmp_ns = ns > ns = gfc_currrent_ns > gfc_current_ns = tmp_ns > free(ns)
Yeah. I could have written ns = gfc_current_ns; gfc_current_ns = gfc_current_ns->parent; gfc_free_namespace (ns); too, but that is longer. I'm also not too much enthusiastic about putting C++ constructs everywhere, but std::swap is actually one of the few things I like about C++ in GCC sources, it is more readable. Jakub