Joerg Sonnenberger via llvm-dev
2017-Jul-21 18:39 UTC
[llvm-dev] Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
On Fri, Jul 21, 2017 at 09:31:41AM -0600, John Regehr via llvm-dev wrote:> I propose documenting in the LangRef that memcpy and related intrinsics are > defined even when src and dst don't refer to valid storage as long as the > length argument is zero. Then we commit to implementing that behavior. Is > that OK with everyone? If so I can update the doc.I don't think that was the conclusion of the discussion? I mean the result was that a NULL pointer should be explicitly valid if the length argument is zero. That's a bit more restrictive. Joerg
John Regehr via llvm-dev
2017-Jul-21 19:02 UTC
[llvm-dev] Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
> I don't think that was the conclusion of the discussion? I mean the > result was that a NULL pointer should be explicitly valid if the length > argument is zero. That's a bit more restrictive.Yeah there's a design space here. I don't care about the result but am volunteering to document whatever people want. John
Ralf Jung via llvm-dev
2017-Jul-21 19:30 UTC
[llvm-dev] Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
Hi, On 21.07.2017 11:39, Joerg Sonnenberger wrote:> On Fri, Jul 21, 2017 at 09:31:41AM -0600, John Regehr via llvm-dev wrote: >> I propose documenting in the LangRef that memcpy and related intrinsics are >> defined even when src and dst don't refer to valid storage as long as the >> length argument is zero. Then we commit to implementing that behavior. Is >> that OK with everyone? If so I can update the doc. > > I don't think that was the conclusion of the discussion? I mean the > result was that a NULL pointer should be explicitly valid if the length > argument is zero. That's a bit more restrictive.What exactly does valid storage even mean here? When memset is called to change 4 bytes, all those 4 bytes have to be in valid storage; but when the count is 0 -- essentially all this needs is an allocation of length 0, which could be pretty much any pointer? NULL is always special and hence need separate consideration, but for non-NULL, aren't they all valid storage of size 0 (but potentially not aligned)? Kind regards, Ralf
Ralf Jung via llvm-dev
2017-Sep-29 13:21 UTC
[llvm-dev] Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
Hi, On 21.07.2017 21:02, John Regehr wrote:>> I don't think that was the conclusion of the discussion? I mean the >> result was that a NULL pointer should be explicitly valid if the length >> argument is zero. That's a bit more restrictive. > > Yeah there's a design space here. I don't care about the result but am > volunteering to document whatever people want.(Context: <https://lists.llvm.org/pipermail/llvm-dev/2017-July/115665.html>) Is there any news on this? I don't even know what the process is. Should I open an issue to track the progress? Kind regards, Ralf
Apparently Analagous Threads
- Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
- Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
- Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
- Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
- Change memcpy/memmove/memset to have dest and source alignment attributes