jdoerfert added a comment. In D96418#2783541 <https://reviews.llvm.org/D96418#2783541>, @leonardchan wrote:
>> Well, no, I'm afraid it is actually clear that that code does have UB >> according to the C++ standard. Perhaps you mean that it *shouldn't* have >> UB, or that Clang should define its behavior despite the standard. >> >> I might agree with you that I don't see the value in using this stronger >> rule in C++, but I think it would help to understand the problem a little >> better. I assume this is causing problems for a less trivial test case? Or >> do you really have code that's relying on that loop not terminating? > > I see. I guess it's good (and bad) that this discovered this UB in our code > base. The example I posted is almost exactly what's in our test case. For > this particular one, we need a non-terminating thread, so a thread_create > function is passed `do_nothing`. Locally, we could get around this by using > something like inline assembly to avoid UB. FWIW, you want an atomic access, something that is explicitly avoiding the UB while "busy waiting". Not just some inline assembly that tries to "hide the fact" it's UB. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96418/new/ https://reviews.llvm.org/D96418 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits