From RISKS: secret scrubbing code removed by optimizers

Carson Gaspar carson at
Fri Nov 8 12:13:30 EST 2002

--On Thursday, November 07, 2002 4:41 PM -0600 Ben Lindstrom 
<mouring at> wrote:

> I know there has been a lot of talk on private OpenBSD lists and it is
> being ensured that gcc never removes memset() entries on OpenBSD.
> Personally I think if gcc is optimizing it away it is incorrect.  I
> believe 3.2+ GCC series supports a flag to leave memsets, but I'm not sure
> how usaged 3.2 is.

If you don't want the memset() optimized away, you should declare the 
variable volatile.


More information about the openssh-unix-dev mailing list