[PATCH] D100141: [nofree] Restrict semantics to memory visible to caller

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 08:03:51 PDT 2021


nhaehnle added a comment.

Thank you for doing this.

The interaction with multi-threading and capturing makes me mildly nervous. Perhaps I'm just confused, but the second paragraph of the definition there seems to imply that a `nofree` (but not-nosync) function `f` is allowed to free any memory that had a pointer to it captured somewhere. But this seems to contradict the first paragraph, which says that `f` "does not, directly or indirectly, call a memory-deallocation function (free, for example) on a memory allocation which existed before the call."

So which is it?

If `f` communicates to another thread in a way that causes that thread to free memory, does that count as an indirect call to a memory-deallocation function? If not, why does capturing the pointer make a difference? An argument to `f` could be temporarily passed to another thread even if it is `nocapture`...

I have a feeling that this confusion already existed in the previous definition.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100141/new/

https://reviews.llvm.org/D100141



More information about the llvm-commits mailing list