On Friday, June 20, 2014 15:20:17 Walter Bright via Digitalmars-d wrote: > http://developers.slashdot.org/story/14/06/20/1824226/overeager-compilers-ca > n-open-security-holes-in-your-code > > This is an opportunity for D to define the spec in such away as to preclude > the bad optimizations while keeping the good ones. Any ideas?
I applaud the sentiment, but I fear that I don't know enough about compiler optimizations to have much in the way of good ideas. It seems like every time the subject comes up, it turns out that compilers do all kinds of crazy things that make it so that half of what you think is guaranteed isn't guaranteed. If you had some way to mark code such that it restricts what the compiler can optimize, then that could help, but you'd have to know that you needed that restriction in the first place, and usually, the problem is that you don't even know what the compiler might optimize out, and not even checking the generated assembly helps in the general case, because what one compiler might leave in, another might optimize out. It's a thorny problem. - Jonathan M Davis
