[PATCH] D86643: [LangRef] Memset/memcpy/memmove can take undef/poison pointer if the size is 0
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 11:19:14 PDT 2020
efriedma added inline comments.
================
Comment at: llvm/docs/LangRef.rst:1161
+ specified alignment, behavior is undefined. ``undef`` and ``poison``
+ pointers have alignment 1.
----------------
aqjune wrote:
> aqjune wrote:
> > jdoerfert wrote:
> > > Unsure if this is needed TBH. Might be confusing.
> > Would it be better if I move this next to `However, they must still be appropriately aligned.` for a better context?
> This sentence was added to clarify this case:
> ```
> ptr = poison
> memset(ptr align 1, 0, 0) // UB?
> ```
> Since `memset(ptr, 0, 0)` is equivalent to `memset(ptr align 1, 0, 0)`, making the latter non-UB seemed natural to me.
I think I would rather state it more like "`align 1` has no effect on non-byval arguments", rather than explicitly refer to undef values. The practical effect is the same, and I think it makes it easier to understand the expected semantics.
================
Comment at: llvm/docs/LangRef.rst:12654
-If "len" is 0, the pointers may be NULL or dangling. However, they must still
-be appropriately aligned.
+If "len" is 0, the pointers may be NULL, dangling, ``undef``, or ``poison``.
+However, they must still be appropriately aligned.
----------------
"pointers"?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86643/new/
https://reviews.llvm.org/D86643
More information about the llvm-commits
mailing list