Obviously, the fundamental issue with concurrency is programmer’s intent. This statement:
x += 1; y -= 1
can be interpreted in two ways: atomic {
x += 1
y -= 1
}
or atomic { x += 1 }
atomic { y -= 1 }
The best the compiler can do would be to alert the programmer of the ambiguity; I know of no compiler that does that.