This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __attribute__((optimize("-O2"))) doesn't work


Iâve tried __attribute__((optimize(âO2â))) and __attribute__((optimize((2))). All didnât work.

Chaoran

> On Dec 22, 2014, at 3:39 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> 
> On Mon, 2014-12-22 at 15:33 -0600, Chaoran Yang wrote:
>> Hi all, 
>> 
>> Iâm trying to use the __attribute__((optimize(â-O2â))) to mark a
>> function that should always be optimized. But it doesnât seem to work.
>> Iâve tested both GCC 4.9.2 and 4.8.3, they both silently ignored the
>> attribute. Iâm wondering if Iâm something super stupid that Iâm not
>> aware of.
> 
> Try __attribute__((optimize("O2"))
> 
> i.e. remove the leading '-'.
> 
> See also:
> https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes
> 
> "Strings that begin with O are assumed to be an optimization option,
> while other options are assumed to be used with a -f prefix. "
> 
> Cheers,
> Oleg
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]