When did 'pragma optimize' become available?

Markus Trippelsdorf markus@trippelsdorf.de
Mon Jul 13 07:14:00 GMT 2015


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).

-- 
Markus



More information about the Gcc-help mailing list