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

--- Comment #19 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #18)
> (In reply to Marc Glisse from comment #17)
> > And if func is inline,
> > it will require -fkeep-inline-functions.
> 
> What is the difference between inline/not inline?

After being inlined and becoming unused, a static or inline function is
discarded (doesn't exist anymore in the pass that warns), while a regular
function still needs to be emitted and is kept.

The function in which it was inlined probably has a use of a dead variable, but
warning for that is harder, as discussed in PR 60517 (I don't think we need to
keep both open).

> > e.cc: In function 'Iter& func(Iter, int)':
> > e.cc:11:20: warning: function returns address of local variable
> > [-Wreturn-local-addr]
> >      return iter += n;
> >                     ^
> 
> Why it points to n?

I am calling warning_at with gimple_location (return_stmt).

Reply via email to