https://bugs.llvm.org/show_bug.cgi?id=50115

            Bug ID: 50115
           Summary: Can __builtin_memcpy be given a null pointer argument?
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Documentation
          Assignee: unassignedclangb...@nondot.org
          Reporter: davidfromonl...@gmail.com
                CC: llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

The C function memcpy cannot be given null pointers as arguments, even if the
size is 0. This is checked by UBSan.

It is unclear whether __builtin_memcpy has this same restriction. UBSan accepts
calls to __builtin_memcpy with null pointer arguments as long as the size is 0.
The documentation does not say whether this is guaranteed behavior.

I hope that it is defined to call it with null pointer arguments, since the
entire reason I'm using it is to avoid that check.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to