From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <28ff9a9c71ca0c354fca1202927d87e2@plan9.bell-labs.com> From: presotto@plan9.bell-labs.com To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] (no subject) Date: Wed, 27 Feb 2002 17:47:15 -0500 Topicbox-Message-UUID: 5a40c54a-eaca-11e9-9e20-41e7f4b1d025 This is what I got out of Cliff Young: Do you mean about the general 9fans topic of whether optimizations are dangerous, or about the specific issue of when you can registerize a global? On the former, one person made the rarely-made point that many people write programs that depend on undefined behavior in the C standard, then gripe when their bugs that are masked with -O0 are exposed with -O2. I think this point isn't made often enough. On the other hand, I'm entirely willing to admit that buggy optimizations passes are the reason why people turn optimizations off. It's hard to write optimizations that are as reliable as, say, hardware. Part of this is that the verification technology is way better on the hardware side, and another part is that writing a good optimizing compiler is a never-ending time sink, and it's hard to get users to send you examples that exhibit bugs, and then even harder to track them down. And this in a program that isn't multithreaded. On registerizing globals, it seems to be that it's entirely safe to registerize as long as control flow doesn't leave your function. I.e., don't expect registerized globals not to mutate across function calls. Threaded programmers know what they're getting themselves into, and ought to be using locks or condition variables.