From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <88457fd0236630c32e5a94bfbad89fd7@vitanuova.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] how to avoid a memset() optimization From: rog@vitanuova.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Wed, 13 Nov 2002 13:55:05 +0000 Topicbox-Message-UUID: 1cb3b326-eacb-11e9-9e20-41e7f4b1d025 > For one thing, it doesn't work (unless you force > volatile qualification within secmemset) which seems reasonable to me. and for barely more runtime cost, one could define: void* secmemset(void *ap, int c, ulong n) { memset((volatile void *)ap, c, n); } (or is that "void * volatile"? i never sussed this C type qualifier stuff). is that not sufficient to stymie any legitimate optimisations that GCC might try to do, while maintaining comparable performance? (not to mention making sure that you don't kill the performance of any crypto tight loops that might be running on the original buffer by declaring it volatile). cheers, rog.