From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <51251da60e579ed6058e741fa0dbff7b@plan9.bell-labs.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] how to avoid a memset() optimization From: "Russ Cox" MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Thu, 14 Nov 2002 01:53:04 -0500 Topicbox-Message-UUID: 1e59592e-eacb-11e9-9e20-41e7f4b1d025 > He doesn't need to know about volatile -- that's the whole point. > Once "experienced" programmer has set the buffer that way, the > less experienced just gets less chance to screw himself up I'd still rather see it closer to the use that needs it. If you're used to seeing secmemset then seeing memset is a big red flag. If you're used to seeing memset with a volatile declaration, then you have to seek out the volatile declaration, which might not be anywhere near the call to memset. This is a stupid argument anyway. Volatile is a crock. Here's another problem. Suppose I'm worried that leaking the processor flags at the end of my computation might reveal something about the secret key. I want to clear them. I could do something like: x = 0 & 0; which in this particular case will clear the appropriate flags. But now the compiler comes along and optimizes away the whole expression. Where do I put my volatile to make that stay? Hmm? The answer is not more crappy qualifiers. The answer is clearly dumber compilers. Russ