https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110827
--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > (In reply to Iain Sandoe from comment #2) > > (In reply to Richard Biener from comment #1) > > > I'm seeing all code properly instrumented. The coverage I see is > > <snip> > > > 1: 27:task foo() { > > > -: 28: std::cout << "Running..." << std::endl; > > > -: 29: co_return; > > > 2: 30:} > > <snip> > > > > > > I have no idea why for example line 28 isn't marked executed. > > > > So we are recognising that the ramp function has run: > > foo () { > > .... compiler-generated code with no line numbers > > } > > > > but execution of the the outlined body (which is the 'actor' function) is > > not, apparently recorded. > > > > The actor is essentially: > > > > foo.actor() > > .. compiler-generated code no line numbers > > { > > std::cout << "Running..." << std::endl; > > co_return; > > } > > .. compiler-generated code no line numbers > > > > co_return expands to some compiler-generated code too - so it's possible the > > line numbers get confusing there - but the cout line ought to be > > uncontroversial. > > Hmm, OK. I see both 'task foo' and _Z3fooPZ3foovE13_Z3foov.Frame.actor > printed as functions "foo" in the IL dump. We have to do that or debug and things like __PRETTY_FUNCTION__ get confused (which led to other Pas). > Maybe coverage is somehow confused here. Perhaps, I do not know much about how the coverage stuff is supposed to operate. coroutine 'helper' functions are marked as such in the function struct - so it is possible to special-case them. > Maybe coverage doesn't work with nested functions (or C++ lambda) either? the coroutine helpers are not (formally) nested i.e. they do _not_ use the nested.cc machinery or a STATIC_CHAIN. (actually, AFAIU lambdas are the same). However, they are both probably 'artificial' and/or anonymous? > As said, there are edge counters present so it must be either a bug on > the receiving side (in gcov) or the data is not appropriately attributed. The basic shape of the coroutine helper functions is 'normal' (other than being artificial) - most of the work is already complete before gimplification - the idea being that they should look as normal as possible to the middle end to allow maximum opportunity for optimisation.