http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56515
--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> 2013-03-04 16:06:25 UTC --- > We build the function decls via build_fn_decl which ends up using > input_location of the first random function we are processing. > > But that doesn't seem to be the issue after all ... > > The issue is that we do in expand_call_inline: > > /* Build a block containing code to initialize the arguments, the > actual inline expansion of the body, and a label for the return > statements within the function to jump to. The type of the > statement expression is the return type of the function call. */ > id->block = make_node (BLOCK); > BLOCK_ABSTRACT_ORIGIN (id->block) = fn; > BLOCK_SOURCE_LOCATION (id->block) = input_location; > if (gimple_block (stmt)) > prepend_lexical_block (gimple_block (stmt), id->block); > > that is, we only link the copied BLOCK tree into the caller BLOCK tree if > the call stmt had an associated BLOCK. Which isn't the case for the > calls created by the middle-end (profile instrumentation in this case). Hmm, yeah, thre are few cases where we sort of assume that each call has a block. I wonder what should we do here, just prepend the block for the outermost block of the caller function then? In general however LTO of libgcov is not supposed to work same way as libgcc or glibc does not work. We can't LTO yet any functions where middle-end invent calls post LTO streaming. I blieve we still do so for libgcov for fork calls. Honza