https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109850
Bug ID: 109850 Summary: ICE compiling ccache 4.8 Product: gcc Version: 12.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: psmith at gnu dot org Target Milestone: --- I've started working with GCC 12.3.0 I've built myself and I've gotten an ICE trying to compile ccache 4.8. The preprocessor output is attached. I'm building using a sysroot from a Rocky Linux 8.4 x86_64 system with glibc 2.28. I'm using my own binutils 2.40. I was able to reduce the command line to just: g++ -o LocalStorage.o -c LocalStorage.i I attached the .i file. Output from my build: $ /data/src/tooldir/bin/x86_64-tools-linux-gnu-g++ -o LocalStorage.o -c LocalStorage.i /data/src/ccache/ccache-4.8/src/storage/local/LocalStorage.cpp: In instantiation of 'storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)> [with auto:39 = unsigned char; auto:40 = std::function<void(double)>]': /data/src/build/x86_64-linux/cc/unknown/x86_64-unknown-linux-gnu/include/c++/12.3.0/type_traits:2559:26: required by substitution of 'template<class _Fn, class ... _Args> static std::__result_of_success<decltype (declval<_Fn>()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>&; _Args = {unsigned char, const std::function<void(double)>&}]' /data/src/build/x86_64-linux/cc/unknown/x86_64-unknown-linux-gnu/include/c++/12.3.0/type_traits:2570:55: required from 'struct std::__result_of_impl<false, false, storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>&, unsigned char, const std::function<void(double)>&>' /data/src/build/x86_64-linux/cc/unknown/x86_64-unknown-linux-gnu/include/c++/12.3.0/bits/std_function.h:348:9: recursively required by substitution of 'template<class _Result, class _Ret> struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t<typename _CTp::type> > [with _Result = std::__invoke_result<storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>&, unsigned char, const std::function<void(double)>&>; _Ret = void]' /data/src/build/x86_64-linux/cc/unknown/x86_64-unknown-linux-gnu/include/c++/12.3.0/bits/std_function.h:348:9: required from 'struct std::function<void(unsigned char, const std::function<void(double)>&)>::_Callable<storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>, storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>, std::__invoke_result<storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>&, unsigned char, const std::function<void(double)>&> >' /data/src/build/x86_64-linux/cc/unknown/x86_64-unknown-linux-gnu/include/c++/12.3.0/bits/std_function.h:353:8: required by substitution of 'template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp> using _Requires = std::__enable_if_t<_Cond::value, _Tp> [with _Cond = std::function<void(unsigned char, const std::function<void(double)>&)>::_Callable<storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>, storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>, std::__invoke_result<storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>&, unsigned char, const std::function<void(double)>&> >; _Tp = void; _Res = void; _ArgTypes = {unsigned char, const std::function<void(double)>&}]' /data/src/build/x86_64-linux/cc/unknown/x86_64-unknown-linux-gnu/include/c++/12.3.0/bits/std_function.h:434:9: required by substitution of 'template<class _Functor, class _Constraints> std::function<void(unsigned char, const std::function<void(double)>&)>::function(_Functor&&) [with _Functor = storage::local::LocalStorage::recompress(std::optional<signed char>, uint32_t, const storage::local::ProgressReceiver&)::<lambda(const auto:39&, const auto:40&)>; _Constraints = <missing>]' /data/src/ccache/ccache-4.8/src/storage/local/LocalStorage.cpp:701:24: required from here /data/src/ccache/ccache-4.8/src/storage/local/LocalStorage.cpp:710:44: internal compiler error: Segmentation fault 710 | LOG("Failed to acquire content lock for {}/{}", l1_index, l2_index); | ^~~~~~~ 0x7f1399b2c08f ??? /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x7f1399b0d082 __libc_start_main ../csu/libc-start.c:308 I tried to use -freport-bug but it said "The bug is not reproducible, so it is likely a hardware or OS problem." But I don't think it's a hardware or OS problem. It could be related to how I compiled GCC maybe? The crash is completely repeatable on my system.