Ignored optimization command

Kirk Liberty kirk.liberty@gmail.com
Sun Feb 24 00:24:00 GMT 2013

Hi all,

I'm  trying to use g++ to compile a function with optimization O2
except for one function I want at O3. I'm not having any luck with
__attribute__ or #pragma. I am using GCC version 4.7.2. With
__attribute__ I am getting a warning that the directive was ignored,
and with #pragma I am simply not seeing the speedup expected.

Here's what I've tried.
bool* getStreamBool(uint64_t num) __attribute__ ((optimize("-O3"))) {...}

#pragma GCC push_options
#pragma GCC optimize ("O3")
bool* getStreambool(uint64_t num) {...}
#pragma GCC pop_options


More information about the Gcc-help mailing list