3 ms·
>But at no point did the compiler say "oh, you wrote to this variable without synchronization! Now I'll show you, hehehe!". That's because the compiler doesn't
by GoblinSlayer 5y ago
>But at no point did the compiler say "oh, you wrote to this variable without synchronization! Now I'll show you, hehehe!".
That's because the compiler doesn't detect the situation. If it knew, it could, say, remove all code leading to that point - it's legal and the resulting code would be faster.
>Compilers can optimize many loops only if they assume signed integer overflow never happens.
I don't think this happens. Most loops iterate over arrays, and at least in C tradition unsigned integers are used as array index with no signed integers in sight.