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

            Bug ID: 477992
           Summary: compiler generated overlapping memcpy diagnosed
    Classification: Developer tools
           Product: valgrind
           Version: unspecified
          Platform: unspecified
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: po...@protonmail.com
  Target Milestone: ---

GCC (and apparently clang as well) specifically requires that memcpy() with an
exact overlap does not trigger undefined behaviour
(https://gcc.godbolt.org/z/E4rqz7bn6):

> Contrary to the standards covering memcpy GCC expects the case of an exact 
> overlap of source and destination to work and not invoke undefined behavior. 

(from https://gcc.gnu.org/onlinedocs/gcc.pdf)

However, it seems valgrind diagnoses these memcpy() calls as invalid, so it may
happen that perfectly valid code is diagnosed as invalid due to the compiler's
code generation.

See also:
https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1799

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

Reply via email to