Hi, On Tue, 26 Jun 2012, Jason Merrill wrote:
> > (the gimplifier code should be in Frontend code that lowers to GENERIC > > really and the WITH_CLEANUP_EXPR code should be C++ frontend specific > > ...). > > TARGET_EXPR has been a back-end code since the dawn of GCC version > control; if it's still only used by the C++ front end I guess it could > move to cp-tree.def, but we can't really lower it until gimplification > time because we need to strip away enclosing COMPOUND_EXPRs and such so > we can see that it's on the RHS of an initialization and optimize away > the temporary in that case. And now that GIMPLE isn't a subset of > GENERIC, we can't just use the gimplifier at genericization time. And > I'd rather not duplicate the entire gimplifier in the front end. I agree with Jason. TARGET_EXPR and CLEANUP_POINT_EXPR might currently be used only for C++, but I think they are sensible general constructs to be supported by the gimplifier. But I also think that the option to disable stack slot sharing should be moved to cfgexpand to trigger non-sharing of everything, not just these cleanup temporaries. After all using the (c++)temporary after expression end is a source bug that the option is supposed to work around, just like this is: char *p; { char str[50]; p = str; } use(p); So, IMO the option should also work around this source bug. We had at least one example of that in our own code base. Ciao, Michael.