Application: kdevelop (5.11.230401 (23.04.1)) Qt Version: 5.15.9 Frameworks Version: 5.106.0 Operating System: Linux 6.3.3-gentoo x86_64 Windowing System: X11 Distribution: "Gentoo Linux" DrKonqi: 5.27.5 [KCrashBackend] -- Information about the crash: Started crashing after I changed the active compiler for the project from GCC to Clang. The crash can be reproduced every time. -- Backtrace (Reduced): #6 __memset_avx2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:328 #7 0x00007f28322a7daf in std::__fill_a1<unsigned short*, int>(unsigned short*, unsigned short*, int const&) (__value=<optimized out>, __last=<optimized out>, __first=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algobase.h:930 #8 std::__fill_a<unsigned short*, int>(unsigned short*, unsigned short*, int const&) (__value=<optimized out>, __last=<optimized out>, __first=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algobase.h:977 #9 std::__fill_n_a<unsigned short*, int, int>(unsigned short*, int, int const&, std::random_access_iterator_tag) (__value=<optimized out>, __n=3277, __first=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algobase.h:1128 #10 std::fill_n<unsigned short*, KDevelop::Bucket<KDevelop::CodeModelRepositoryItem, KDevelop::CodeModelRequestItem, true, 0u>::{unnamed type#3}, int>(KDevelop::Bucket<KDevelop::CodeModelRepositoryItem, KDevelop::CodeModelRequestItem, true, 0u>::{unnamed type#3}, KDevelop::Bucket<KDevelop::CodeModelRepositoryItem, KDevelop::CodeModelRequestItem, true, 0u>::{unnamed type#3}, int const&) (__value=<optimized out>, __n=KDevelop::Bucket<KDevelop::CodeModelRepositoryItem, KDevelop::CodeModelRequestItem, true, 0>::NextBucketHashSize, __first=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algobase.h:1157 Reported using DrKonqi
Created attachment 159329 [details] New crash information added by DrKonqi DrKonqi auto-attaching complete backtrace.
Cannot reproduce on Manjaro GNU/Linux. My GCC version is: gcc (GCC) 12.2.1 20230201 In my stl_algobase.h I see this code: ``` template<typename _ForwardIterator, typename _Tp> _GLIBCXX20_CONSTEXPR inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __fill_a1(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { const _Tp __tmp = __value; for (; __first != __last; ++__first) *__first = __tmp; } // Specialization: for char types we can use memset. template<typename _Tp> _GLIBCXX20_CONSTEXPR inline typename __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type __fill_a1(_Tp* __first, _Tp* __last, const _Tp& __c) { const _Tp __tmp = __c; #if __cpp_lib_is_constant_evaluated if (std::is_constant_evaluated()) { for (; __first != __last; ++__first) *__first = __tmp; return; } #endif if (const size_t __len = __last - __first) __builtin_memset(__first, static_cast<unsigned char>(__tmp), __len); } ``` The line at kdevplatform/serialization/itemrepository.h:734: std::fill_n(m_nextBucketHash, NextBucketHashSize, 0); Declaration: unsigned short* m_nextBucketHash Since `unsigned short` is not a byte type (the size is 2 bytes), the loop overload of __fill_a1 should be called. But your backtrace ends with `__memset_avx2_unaligned_erms`, which suggests that the memset overload is called on your system or the compiler optimizes the loop into a memset instruction. What is your GCC version and the function at stl_algobase.h:930 on your system? Which optimization flags have you built KDevelop with? Is memset-ing a memory-mapped region supported by GCC? If so, maybe there is some memset+memmap bug in your libstdc++ version?
Hi, first of all, after clearing the cache it no longer crashes. But if it helps to prevent this in the future: The entire system is built with CFLAGS="-march=native -ggdb3 -O2 -pipe -fdiagnostics-color". See attached compiler.info for what -march=native translates to on my system. This is the content of stl_algobase.h around that line. template<typename _ForwardIterator, typename _Tp> _GLIBCXX20_CONSTEXPR inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __fill_a1(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { const _Tp __tmp = __value; 930: for (; __first != __last; ++__first) *__first = __tmp; }
Created attachment 159346 [details] compiler.info
(In reply to Andrei Slavoiu from comment #3) > Hi, first of all, after clearing the cache it no longer crashes. Did you recently update from a custom-built unreleased KDevelop master version? If yes, perhaps the cache wasn't cleared for some reason. On the other hand, the merge request that introduced the crashing code https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/445 increments KDEV_ITEMREPOSITORY_INCREMENT, which forces clearing the cache. But let us close this bug for now in case this is a cache issue. Reopen if it occurs again.
*** This bug has been marked as a duplicate of bug 488043 ***