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

--- Comment #2 from davidxl <xinliangli at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> First of all you should mark the functions 'inline' as well.

This does not help.

  Then the issue
> is that 'eq' is called indirectly which isn't allowed for always_inline
> functions:


Is this documented somewhere? A function can be called indirectly and directly.
What is the right way to force inlining the direct calls?

A warning is already emitted about always_inline might not be inlinable, why
the error?

> 
> t.C:81:66: error: inlining failed in call to always_inline 'static constexpr
> bool std::__1::char_traits<char>::eq(std::__1::char_traits<char>::char_type,
> std::__1::char_traits<char>::char_type)': indirect function call with a yet
> undetermined callee
>        __attribute__ (( __always_inline__)) static constexpr bool
> eq(char_type __c1, char_type __c2)  {
>                                                                   ^
> t.C:75:37: error: called from here
>              if (!__pred(*__m1, *__m2)) { } 
>                                      ^
> 
> which means this is a missed-optimization only.  The error is your fault.
> 
> Note that getting the error is unreliable so -O0 simply doesn't discover the
> failed inlining.

-O2 works fine -- I have not debugged the problem -- but it seems to be some
newly cloned cgraph edge to be in inconsistent state.

David

Reply via email to