Reply to post: Optimization

Monday: Intel touts 28-core desktop CPU. Tuesday: AMD turns Threadripper up to 32

Anonymous Coward
Anonymous Coward

Optimization

A (standards) conforming compiler is not permitted to change the behaviour of a strictly-conforming program (one that follows the rules).

The problem is that a lot of C code contains instances of undefined behaviour. These are often benign at low (or no) optimization levels, but do cause some real surprises at higher optimization levels. The programmer is basically required to honour a contract specified within the standard, and the optimizer assumes that is the case.

The important thing here is it is the code that is broken, not the compiler. Unfortunately, it is fairly easy to introduce undefined behaviour into the code accidentally - and there is no requirement for the compiler to issue a diagnostic.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon