Can a conforming implementation produce an execution that is different from the logical deduction according to the standard?
Consider this example: #include <atomic> int main(){ std::atomic<bool> flag = false; while(!flag.load(relaxed)); } IIUC, the program should never exit due to the control flow dependencies. That is, the program exits implies the loop exits, which in turn, requires that there is a side effect setting the flag to be true and the side effect doesn't happen after the value computation. The relevant formal rules are [stmt.while] p1 In the while statement, the substatement is executed repeatedly until the value of the condition ([stmt.pre]) becomes false. [intro.races] p10 The value of an atomic obje
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.