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: Force inline without -O2


Am 28.12.2009 13:30, schrieb Jie Zhang:
On 12/28/2009 08:21 PM, Thomas Martitz wrote:
Am 28.12.2009 04:22, schrieb Jie Zhang:
I think __attribute__((always_inline)) is used to inline functions
even not optimizing. Below is from GCC manual:

always_inline
Generally, functions are not inlined unless optimization is
specified. For functions declared inline, this attribute inlines the
function even if no optimization level was specified.


That just means that it's inlined under the implicit default
optimization level -O1 (that is what you get "if no optimization level
was specified"). If you set -O0, it will not inline. I had problem where
-O0 broke code that is depended on being inlined.

GCC uses -O0 by default, not -O1.


Jie

Hmm, ok, but it doesn't inline functions marked with __attribute__((always_inline)) with -O0. I tried that with gcc 4.4.2 for the arm-eabi target. Maybe it's a bug then, or maybe the manual means -O for "no optimization level specified"?


Best regards.


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