[PATCH] D59307: Patch llvm bug 41033 concerning atomicity of statement expressions

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 13:49:40 PDT 2019

jfb added a comment.

In D59307#1428101 <https://reviews.llvm.org/D59307#1428101>, @mibintc wrote:

> In D59307#1427644 <https://reviews.llvm.org/D59307#1427644>, @jfb wrote:
> > I think you also want to test C++ `std::atomic` ...
> The bug described in https://bugs.llvm.org/show_bug.cgi?id=41033 doesn't occur using C++ atomic, I rewrote the test case this way, and it compiles without error.  The "load" operation returns int since all the atomic operations occur under the covers using builtins.   Does this convey the test you have in mind?
> #include <atomic>
>  int fum(int y) {
>   std::atomic<int> x(1);
>   y = ({x.load();});
> }

What I had in mind with `atomic` isn't relevant, because it would try to call `atomic(const atomic&) = delete;`. Your test case here isn't something I'm worried about.

`volatile` is still and issue.

I'm still not sure this is something we want.

  rC Clang



More information about the cfe-commits mailing list