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! > 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. > 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. > 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? Cheers, Manuel.