https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91929

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Milian Wolff from comment #7)
> to me, that backtrace looks quite nice and usable - a huge improvement,
> thanks!
> 
> what you are saying is that if the same file would be calling sin/cos
> somewhere else, only one of those inline locations would show up? too bad,
> but I can see how it's impossible to map this in an efficient way...

Yeah, so consider

double A (double x) { return sin(x); }
double B (double x) { return sin(x); }

double foo(double x, int which)
{
  double res;
  if (which == 1)
    res = A (x);
  else
    res = B (x);
}

when GCC inlines both functions and performs code hoisting to get the
following optimized function then the call to sin will always appear
to come from either A or B (and that quite randomly).

double foo(double x)
{
  return sin(x);
}

This exact situation of course shouldn't happen very often but with C++
and some more contrieved examples you may run into a situation that can
be mapped to this.  And I'm not sure that the original behavior which
for this particular case would simply say sin() was called from foo()
wouldn't be better than the patched behavior which says the call
was always from A.

Reply via email to