On Mon, Sep 21, 2015 at 11:59 AM, Manuel López-Ibáñez <lopeziba...@gmail.com> wrote: > On 21 September 2015 at 10:18, Richard Biener > <richard.guent...@gmail.com> wrote: >> input_location is set from the call stmt: >> >> /* FIXME: instantiate_decl isn't called by inlinable_function_p. */ >> saved_location = input_location; >> input_location = gimple_location (stmt); >> >> it would be nice to get rid of that. > > I could replace all uses of input_location in this function by > gimple_location(stmt) as I noted in the comments. Would that be ok if > it works? I'm not sure I can prove that input_location is not used > behind the scenes for some other purpose (all the more reason to kill > input_location once and for all). Friends, don't let friends use > input_location in new code!
Yeah... not sure how to check but to look for any changes in generated cc1/cc1plus debug info. You could also try making it invalid (-1?) and hope libcpp would eventually blow up if that is used. >> If the call is artificially generated it might have no location so I >> think the assert >> is bogus. Also in the case of UNKNOWN_LOCATION it would be nice to at > > I was sure of that, but I was also surprised that not a single > testcase was triggering it. I can re-submit without the assert. please >> least note the function we are failing to inline to (thus, use >> DECL_SOURCE_LOCATION >> of cfun->decl). So better add a diag_location and compute that upfront to >> avoid >> repeating the check. > > error ("inlining failed in call to always_inline %q+F: %s", fn, > cgraph_inline_failed_string (reason)); > > The call is using '+F', thus the location is set to some location > related to F, depending on which *_printer function is active at that > moment. cp_printer uses location_of, and default_tree_printer uses > DECL_SOURCE_LOCATION. Is the default_tree_printer always used at this > point? If yes, I completely agree we should use an explicit > DECL_SOURCE_LOCATION. The meaning of '+' is not only opaque but it > breaks #pragma GCC diagnostic. But it prints the location of the function we failed to inline. I want to retain at least an approximation to the location of the call, which is the location of the function we inline _to_. > >> Did you investigate the glibc case on whether caller or callee are >> artificial? > > No, I could not get glibc to compile. Unfortunately, the machine of > the compile farm that I use to work on GCC is too old. Installing > locally all up-to-date dependencies would require too much time from > me that is better spent on other things. Nevertheless, printing "cc1: > called from here" is always bogus. Not printing it is better. If we > could print something smarter, that would be perfect, but I don't know > how to do that, so "better" is good enough for me. Would you agree? Well, it's easy to do better, see above. Richard. > Cheers, > > Manuel.