[PATCH] D138958: [clang] Better UX for Clang’s unwind-affecting attributes

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 18:32:16 PST 2023


lebedev.ri added a comment.

In D138958#4045567 <https://reviews.llvm.org/D138958#4045567>, @efriedma wrote:

> From an IR semantics standpoint, I'm not sure the `memory(none)` marking is right if the function throws an exception.

Then `memory(read)` would be wrong, either.
A bit of a hot take: it's a Schrodinger's exception in quantum state.
What i mean by that, is that e.g. `pure` attribute is documented as

  and will not cause any observable side-effects other than
  returning a value. They may read memory, but can not modify memory in a way
  that would either affect observable state or their outcome on subsequent runs.

So if it does unwind, that's fine, but if you *observed* that (not by catching an exception),
then you're in UB lands, because *you*, not the function, violated it's contract.

That might be too hot of a take, but it does seem like the EH internal details aren't really *that* observable...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138958



More information about the cfe-commits mailing list