serenity icon indicating copy to clipboard operation
serenity copied to clipboard

GCC 14 build error: inlining failed in call to ‘always_inline’

Open Seirdy opened this issue 2 years ago • 6 comments

On Fedora 40 and Fedora Rawhide, building reliably fails. Currently attempting to build Ladybird. Consistently reproduced with and without any custom build flags.

  • OS: Fedora release 40 (Forty) x86_64
  • Kernel: 6.8.5-301.fc40.x86_64
  • CPU: Intel i5-4300U (2) @ 2.900GHz
  • Compiler: GCC 14.0.1 20240411 (Red Hat 14.0.1-0)

Full output:

[0/2] Re-checking globbed directories...
[16/2544] Building CXX object Lagom/CMa...nityOS/serenity/AK/CircularBuffer.cpp.o
FAILED: Lagom/CMakeFiles/AK.dir/vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp.o
/usr/lib64/ccache/c++ -DAK_EXPORTS -DENABLE_COMPILETIME_FORMAT_CHECK -I/vcs/git/github.com/SerenityOS/serenity -I/vcs/git/github.com/SerenityOS/serenity/Userland/Services -I/vcs/git/github.com/SerenityOS/serenity/Userland/Libraries -I/vcs/git/github.com/SerenityOS/serenity/Build/ladybird/Lagom -I/vcs/git/github.com/SerenityOS/serenity/Build/ladybird/Lagom/Userland/Services -I/vcs/git/github.com/SerenityOS/serenity/Build/ladybird/Lagom/Userland/Libraries -I/vcs/git/github.com/SerenityOS/serenity/Meta/Lagom/../.. -I/vcs/git/github.com/SerenityOS/serenity/Meta/Lagom/../../Userland -I/vcs/git/github.com/SerenityOS/serenity/Meta/Lagom/../../Userland/Libraries -I/vcs/git/github.com/SerenityOS/serenity/Meta/Lagom/../../Userland/Services -I/vcs/git/github.com/SerenityOS/serenity/Build/ladybird -std=c++20 -fPIC -fdiagnostics-color=always -Wall -Wextra -Wno-invalid-offsetof -Wno-unknown-warning-option -Wno-unused-command-line-argument -fno-exceptions -ffp-contract=off -Werror -Wno-expansion-to-defined -Wno-literal-suffix -Wno-dangling-reference -fno-semantic-interposition -fvisibility-inlines-hidden -Wno-maybe-uninitialized -Wno-shorten-64-to-32 -fsigned-char -ggnu-pubnames -fPIC -D_FILE_OFFSET_BITS=64 -O2 -g1 -MD -MT Lagom/CMakeFiles/AK.dir/vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp.o -MF Lagom/CMakeFiles/AK.dir/vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp.o.d -o Lagom/CMakeFiles/AK.dir/vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp.o -c /vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp
In file included from /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:11,
                 from /vcs/git/github.com/SerenityOS/serenity/AK/ByteBuffer.h:11,
                 from /vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.h:9,
                 from /vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp:7:
In constructor ‘AK::Detail::InheritFromPacks<AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromPacks(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’,
    inlined from ‘AK::Variant<AK::Empty, AK::Error>::Variant(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:360:97,
    inlined from ‘AK::ErrorOr<T, ErrorType>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error; T = AK::Empty; E = AK::Error]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:175:11,
    inlined from ‘AK::ErrorOr<void>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error][inherited from AK::ErrorOr<AK::Empty, AK::Error>]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:214:38,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_ensure_capacity(size_t) [with T = int; long unsigned int inline_capacity = 64]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:651:44,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_resize(size_t, bool) requires ! AK::Vector<T, inline_capacity>::contains_reference [with T = int; long unsigned int inline_capacity = 64]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:676:9,
    inlined from ‘void AK::Vector<T, inline_capacity>::resize(size_t, bool) requires ! AK::Vector<T, inline_capacity>::contains_reference [with T = int; long unsigned int inline_capacity = 64]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:722:9:
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:196:95: error: inlining failed in call to ‘always_inline’ ‘AK::Detail::InheritFromUniqueEntries<1, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromUniqueEntries(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’: call is unlikely and code size would grow
  196 |     using BlankIfDuplicate<Ts, Conditional<Js <= I, ParameterPack<>, Qs>...>::BlankIfDuplicate...;
      |                                                                                               ^~~
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:208:98: note: called from here
  208 |     using InheritFromUniqueEntries<Is, Ps, IndexSequence<Is...>, Ps...>::InheritFromUniqueEntries...;
      |                                                                                                  ^~~
In constructor ‘AK::Detail::InheritFromPacks<AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromPacks(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’,
    inlined from ‘AK::Variant<AK::Empty, AK::Error>::Variant(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:360:97,
    inlined from ‘AK::ErrorOr<T, ErrorType>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error; T = AK::Empty; E = AK::Error]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:175:11,
    inlined from ‘AK::ErrorOr<void>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error][inherited from AK::ErrorOr<AK::Empty, AK::Error>]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:214:38,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_ensure_capacity(size_t) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:651:44,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_grow_capacity(size_t) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:641:68,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_append(T&&) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:560:9:
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:196:95: error: inlining failed in call to ‘always_inline’ ‘AK::Detail::InheritFromUniqueEntries<1, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromUniqueEntries(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’: call is unlikely and code size would grow
  196 |     using BlankIfDuplicate<Ts, Conditional<Js <= I, ParameterPack<>, Qs>...>::BlankIfDuplicate...;
      |                                                                                               ^~~
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:208:98: note: called from here
  208 |     using InheritFromUniqueEntries<Is, Ps, IndexSequence<Is...>, Ps...>::InheritFromUniqueEntries...;
      |                                                                                                  ^~~
In constructor ‘AK::Detail::InheritFromPacks<AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromPacks(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’,
    inlined from ‘AK::Variant<AK::Empty, AK::Error>::Variant(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:360:97,
    inlined from ‘AK::ErrorOr<T, ErrorType>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error; T = AK::Empty; E = AK::Error]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:175:11,
    inlined from ‘AK::ErrorOr<void>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error][inherited from AK::ErrorOr<AK::Empty, AK::Error>]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:214:38,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_ensure_capacity(size_t) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:651:44,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_grow_capacity(size_t) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:641:68,
    inlined from ‘AK::ErrorOr<void> AK::Vector<T, inline_capacity>::try_append(T&&) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:560:9,
    inlined from ‘void AK::Vector<T, inline_capacity>::append(T&&) [with T = AK::Span<const unsigned char>; long unsigned int inline_capacity = 2]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Vector.h:262:13,
    inlined from ‘AK::Optional<AK::SearchableCircularBuffer::Match> AK::SearchableCircularBuffer::find_copy_in_seekback(size_t, size_t)’ at /vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp:412:24:
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:196:95: error: inlining failed in call to ‘always_inline’ ‘AK::Detail::InheritFromUniqueEntries<1, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromUniqueEntries(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’: call is unlikely and code size would grow
  196 |     using BlankIfDuplicate<Ts, Conditional<Js <= I, ParameterPack<>, Qs>...>::BlankIfDuplicate...;
      |                                                                                               ^~~
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:208:98: note: called from here
  208 |     using InheritFromUniqueEntries<Is, Ps, IndexSequence<Is...>, Ps...>::InheritFromUniqueEntries...;
      |                                                                                                  ^~~
In constructor ‘AK::Detail::InheritFromPacks<AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromPacks(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’,
    inlined from ‘AK::Variant<AK::Empty, AK::Error>::Variant(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:360:97,
    inlined from ‘AK::ErrorOr<T, ErrorType>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error; T = AK::Empty; E = AK::Error]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:175:11,
    inlined from ‘AK::ErrorOr<void>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error][inherited from AK::ErrorOr<AK::Empty, AK::Error>]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:214:38,
    inlined from ‘AK::ErrorOr<void> AK::HashTable<T, TraitsForT, IsOrdered>::try_rehash(size_t) [with T = AK::HashMap<long unsigned int, long unsigned int>::Entry; TraitsForT = AK::HashMap<long unsigned int, long unsigned int>::EntryTraits; bool IsOrdered = false]’ at /vcs/git/github.com/SerenityOS/serenity/AK/HashTable.h:536:44,
    inlined from ‘AK::ErrorOr<AK::HashSetResult> AK::HashTable<T, TraitsForT, IsOrdered>::try_set(U&&, AK::HashSetExistingEntryBehavior) [with U = AK::HashMap<long unsigned int, long unsigned int>::Entry; T = AK::HashMap<long unsigned int, long unsigned int>::Entry; TraitsForT = AK::HashMap<long unsigned int, long unsigned int>::EntryTraits; bool IsOrdered = false]’ at /vcs/git/github.com/SerenityOS/serenity/AK/HashTable.h:363:13,
    inlined from ‘AK::ErrorOr<AK::HashSetResult> AK::HashMap<K, V, KeyTraits, ValueTraits, IsOrdered>::try_set(const K&, const V&) [with K = long unsigned int; V = long unsigned int; KeyTraits = AK::Traits<long unsigned int>; ValueTraits = AK::Traits<long unsigned int>; bool IsOrdered = false]’ at /vcs/git/github.com/SerenityOS/serenity/AK/HashMap.h:63:105,
    inlined from ‘AK::ErrorOr<void> AK::SearchableCircularBuffer::insert_location_hash(AK::ReadonlyBytes, size_t)’ at /vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp:530:9:
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:196:95: error: inlining failed in call to ‘always_inline’ ‘AK::Detail::InheritFromUniqueEntries<1, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromUniqueEntries(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’: call is unlikely and code size would grow
  196 |     using BlankIfDuplicate<Ts, Conditional<Js <= I, ParameterPack<>, Qs>...>::BlankIfDuplicate...;
      |                                                                                               ^~~
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:208:98: note: called from here
  208 |     using InheritFromUniqueEntries<Is, Ps, IndexSequence<Is...>, Ps...>::InheritFromUniqueEntries...;
      |                                                                                                  ^~~
In constructor ‘AK::Detail::InheritFromPacks<AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromPacks(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’,
    inlined from ‘AK::Variant<AK::Empty, AK::Error>::Variant(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:360:97,
    inlined from ‘AK::ErrorOr<T, ErrorType>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error; T = AK::Empty; E = AK::Error]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:175:11,
    inlined from ‘AK::ErrorOr<void>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error][inherited from AK::ErrorOr<AK::Empty, AK::Error>]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:214:38,
    inlined from ‘AK::ErrorOr<void> AK::HashTable<T, TraitsForT, IsOrdered>::try_rehash(size_t) [with T = AK::HashMap<unsigned int, long unsigned int>::Entry; TraitsForT = AK::HashMap<unsigned int, long unsigned int>::EntryTraits; bool IsOrdered = false]’ at /vcs/git/github.com/SerenityOS/serenity/AK/HashTable.h:536:44,
    inlined from ‘AK::ErrorOr<AK::HashSetResult> AK::HashTable<T, TraitsForT, IsOrdered>::try_set(U&&, AK::HashSetExistingEntryBehavior) [with U = AK::HashMap<unsigned int, long unsigned int>::Entry; T = AK::HashMap<unsigned int, long unsigned int>::Entry; TraitsForT = AK::HashMap<unsigned int, long unsigned int>::EntryTraits; bool IsOrdered = false]’ at /vcs/git/github.com/SerenityOS/serenity/AK/HashTable.h:363:13,
    inlined from ‘AK::ErrorOr<AK::HashSetResult> AK::HashMap<K, V, KeyTraits, ValueTraits, IsOrdered>::try_set(const K&, const V&) [with K = unsigned int; V = long unsigned int; KeyTraits = AK::Traits<unsigned int>; ValueTraits = AK::Traits<long unsigned int>; bool IsOrdered = false]’ at /vcs/git/github.com/SerenityOS/serenity/AK/HashMap.h:63:105,
    inlined from ‘AK::ErrorOr<void> AK::SearchableCircularBuffer::insert_location_hash(AK::ReadonlyBytes, size_t)’ at /vcs/git/github.com/SerenityOS/serenity/AK/CircularBuffer.cpp:532:5:
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:196:95: error: inlining failed in call to ‘always_inline’ ‘AK::Detail::InheritFromUniqueEntries<1, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromUniqueEntries(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’: call is unlikely and code size would grow
  196 |     using BlankIfDuplicate<Ts, Conditional<Js <= I, ParameterPack<>, Qs>...>::BlankIfDuplicate...;
      |                                                                                               ^~~
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:208:98: note: called from here
  208 |     using InheritFromUniqueEntries<Is, Ps, IndexSequence<Is...>, Ps...>::InheritFromUniqueEntries...;
      |                                                                                                  ^~~
In constructor ‘AK::Detail::InheritFromPacks<AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromPacks(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’,
    inlined from ‘AK::Variant<AK::Empty, AK::Error>::Variant(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:360:97,
    inlined from ‘AK::ErrorOr<T, ErrorType>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error; T = AK::Empty; E = AK::Error]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:175:11,
    inlined from ‘AK::ErrorOr<void>::ErrorOr(U&&) requires requires{T((declval<U>)());} || requires{ErrorType((declval<typename AK::Detail::__RemoveVolatile<typename AK::Detail::__RemoveConst<typename AK::Detail::__RemoveReference<U>::Type>::Type>::Type>)());} [with U = AK::Error][inherited from AK::ErrorOr<AK::Empty, AK::Error>]’ at /vcs/git/github.com/SerenityOS/serenity/AK/Error.h:214:38,
    inlined from ‘AK::ErrorOr<void> AK::Detail::ByteBuffer<inline_capacity>::try_ensure_capacity_slowpath(size_t) [with long unsigned int inline_capacity = 32]’ at /vcs/git/github.com/SerenityOS/serenity/AK/ByteBuffer.h:340:44:
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:196:95: error: inlining failed in call to ‘always_inline’ ‘AK::Detail::InheritFromUniqueEntries<1, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::IntegerSequence<long unsigned int, 0, 1>, AK::Detail::ParameterPack<AK::Detail::VariantConstructors<AK::Empty, AK::Variant<AK::Empty, AK::Error> > >, AK::Detail::ParameterPack<AK::Detail::VariantConst
ructors<AK::Error, AK::Variant<AK::Empty, AK::Error> > > >::InheritFromUniqueEntries(AK::Error&&) requires requires{T(std::move(AK::Detail::VariantConstructors<T, Base>::__ct ::t));Base;}[inherited from AK::Detail::VariantConstructors<AK::Error, AK::Variant<AK::Empty, AK::Error> >]’: call is unlikely and code size would grow
  196 |     using BlankIfDuplicate<Ts, Conditional<Js <= I, ParameterPack<>, Qs>...>::BlankIfDuplicate...;
      |                                                                                               ^~~
/vcs/git/github.com/SerenityOS/serenity/AK/Variant.h:208:98: note: called from here
  208 |     using InheritFromUniqueEntries<Is, Ps, IndexSequence<Is...>, Ps...>::InheritFromUniqueEntries...;
      |                                                                                                  ^~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-shorten-64-to-32’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-unused-command-line-argument’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
[18/2544] Building CXX object Lagom/CMa...SerenityOS/serenity/AK/ByteString.cpp.o
ninja: build stopped: subcommand failed.

Seirdy avatar Apr 19 '24 03:04 Seirdy

call is unlikely and code size would grow

Someone brought this up on discord within the last few weeks. I'm not sure why GCC is ignoring our directive. We said always inline, and we mean it. @alimpfard found that removing the ALWAYS_INLINE directive, (which should make the error go away) is a 10% performance reduction in our test-js test suite.

The reduction with cvise is like so:

template <typename Base> struct VariantConstructors {
  __attribute__((always_inline)) VariantConstructors(int t) {
    base().set(t, {});
  }
  Base base();
};
struct Variant : VariantConstructors<Variant> {
  using VariantConstructors<Variant>::VariantConstructors;

  template <typename T> void set(T &&, int);
  char m_data;
};
struct ErrorOr {
  ErrorOr(int v) : a(v) {}
  Variant a;
};
static ErrorOr run() {
  ErrorOr x(0);
  return 0;
}
int serenity_main() {
    run();
}

Perhaps today is a good day to file that GCC bug report :P

https://godbolt.org/z/dcd57jTd4

ADKaster avatar Apr 19 '24 05:04 ADKaster

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

ADKaster avatar Apr 19 '24 20:04 ADKaster

Did a full Serenity build with the toolchain updated to GCC 14 trunk; we need two additional changes beside the GCC fix: #24040.

@alimpfard found that removing the ALWAYS_INLINE directive, (which should make the error go away) is a 10% performance reduction in our test-js test suite.

Note that the offending commit linked by Jakub pointed out that GCC used to entirely ignore the always_inline attribute on inherited constructors until recently. What did Ali measure exactly? We should re-evaluate the run-time and compile-time perf changes + its effect on code size, at the very least.

The discussion of PR110334 pointed out that we weren't copying the always_inline attribute, leading to poor inlining choices.

BertalanD avatar Apr 20 '24 13:04 BertalanD

What did Ali measure exactly?

Execution time of test-js (10 runs iirc) with and without ALWAYS_INLINE on VariantConstructor's ctors.

copied from discord:

FLATTEN on those: 3635
ALWAYS_INLINE: 3301.8
"idk, whatever gcc 13 does" nothing: 3636.8

alimpfard avatar Apr 20 '24 13:04 alimpfard

The upstream gcc bug has been closed with commit https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=aa73eb97a1e3c84564fa71158d09f9c5582c4d2e. Hopefully this makes it into the fedora 40 release.

ADKaster avatar Apr 23 '24 08:04 ADKaster

Hopefully this makes it into the fedora 40 release.

Just updated to f40, unfortunately this isn't the case :(

jamierocks avatar Apr 23 '24 20:04 jamierocks

Since the fix for this made it into GCC 14.1.0, and the package for that on Fedora 40 is building right now I'll close this issue. Hopefully there's no extra surprises in the release package!

ADKaster avatar May 08 '24 22:05 ADKaster