]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use memcpy instead of memmove in __relocate_a_1
authorJan Hubicka <jh@suse.cz>
Fri, 24 Nov 2023 16:59:44 +0000 (17:59 +0100)
committerJan Hubicka <jh@suse.cz>
Fri, 24 Nov 2023 16:59:44 +0000 (17:59 +0100)
__relocate_a_1 is used to copy data after vector reizing.  This can be done by memcpy
rather than memmove.

libstdc++-v3/ChangeLog:

PR middle-end/109849
* include/bits/stl_uninitialized.h (__relocate_a_1): Use memcpy instead
of memmove.

libstdc++-v3/include/bits/stl_uninitialized.h

index 1282af3bc43f322f21e3067590a3cf662dae3592..a9b802774c66ecec8d9839fb29e537eaee53dfa4 100644 (file)
@@ -1119,14 +1119,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #ifdef __cpp_lib_is_constant_evaluated
          if (std::is_constant_evaluated())
            {
-             // Can't use memmove. Wrap the pointer so that __relocate_a_1
+             // Can't use memcpu. Wrap the pointer so that __relocate_a_1
              // resolves to the non-trivial overload above.
              __gnu_cxx::__normal_iterator<_Tp*, void> __out(__result);
              __out = std::__relocate_a_1(__first, __last, __out, __alloc);
              return __out.base();
            }
 #endif
-         __builtin_memmove(__result, __first, __count * sizeof(_Tp));
+         __builtin_memcpy(__result, __first, __count * sizeof(_Tp));
        }
       return __result + __count;
     }