5 ms·
> In the snippet below, the compiler is allowed to eliminate all code after “leave secrets in array c” gcc 4.4.5 doesn't though (-O3), it still clears the stac
by lazyjones 12y ago
> In the snippet below, the compiler is allowed to eliminate all code after “leave secrets in array c”
gcc 4.4.5 doesn't though (-O3), it still clears the stack once and performs the comparison.
I believe these optimizations can be defeated by declaring a global
volatile char fill = 0;
and using that instead of 0 in memset().
- MichaelGG 12y agoIt's not guaranteed to defeat the optimization. For instance, it could just read fill into two registers and do the comparison there.