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

--- Comment #3 from ASA <aaron_sami_abassi at hotmail dot com> ---
(In reply to Richard Biener from comment #2)
> The issue is you fail to make PerformQuickly and PerformSafely const and GCC
> doesn't have local analysis to promote it so and IPA analysis is too late
> for that since it is also the last inlining point.
> 
> Slight complication is nested functions and OMP outlining which may refer to
> these variables.  But even the initial cgraph build should be able to figure
> out the const-ness, no?
> 
> Workaround: make the vars const.


I stated that const solves the issue in the description.  If the auto variables
have automatic duration (remove the keyword static), the compiler is able to
inline the invocation without the const qualifier.  As stated, LLVM (clang++)
does inline the invocation even if it has static duration.

I would expect this is likely true for any non-const static duration function
pointer, not just the case when the auto type specifier is used, but I have not
confirmed it.

Reply via email to