On Mon, Jul 13, 2015 at 3:14 AM, Markus Trippelsdorf <markus@xxxxxxxxxxxxxxx> wrote: > On 2015.07.12 at 20:32 -0400, Jeffrey Walton wrote: >> I've got a crash under GCC 4.9/x86_64 when using -O3. (The crash is >> related to an array that's 64-bit aligned, but GCC selects the vmovdqa >> instruction, which has 128-bit alignment requirements.) >> >> It was easy enough to back-off optimizations: >> >> #pragma GCC optimize push >> #pragma GCC optimize ("-O2") >> >> void xorbuf(byte *buf, const byte *mask, size_t count) >> { >> ... >> } >> #pragma GCC optimize pop >> > > This is a bad idea in general, because "pragma GCC optimize" is meant as > a compiler debugging aid only. It should _not_ be used in production > code. > Please fix the underlying issue instead (, or open a bug for it). We cleared the issue; thanks for the advice. I have one more question related to the use of '#pragma GCC optimize'. I have a zeroizer that must execute due to Certification and Accreditation (C&A) requirements. When the zeroizer is removed as a dead store, the compiler folks usually say, "but you asked for optimizations...". If we cannot use '#pragma GCC optimize' to turn off the optimizer for a function, then how do we tell the compiler to *not* remove the code?