https://bugs.kde.org/show_bug.cgi?id=470428

Igor Kushnir <igor...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|REPORTED                    |NEEDSINFO
                 CC|                            |igor...@gmail.com

--- Comment #2 from Igor Kushnir <igor...@gmail.com> ---
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?

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to