Messages in this thread | | | Date | Thu, 8 Jul 2004 08:07:19 -0400 | From | Jakub Jelinek <> | Subject | Re: GCC 3.4 and broken inlining. |
| |
On Thu, Jul 08, 2004 at 09:46:39PM +1000, Nigel Cunningham wrote: > In response to a user report that suspend2 was broken when compiled with > gcc 3.4, I upgraded my compiler to 3.4.1-0.1mdk. I've found that the > restore_processor_context, defined as follows: > > static inline void restore_processor_context(void) > > doesn't get inlined. GCC doesn't complain when compiling the file, and > so far as I can see, there's no reason for it not to inline the routine.
Try passing -Winline, it will tell you when a function marked inline is not actually inlined. Presence of inline keyword is not a guarantee the function will not be inlined, it is a hint to the compiler. GCC 3.4 is much bettern than earlier 3.x GCCs in actually inlining functions marked as inline, but there are still cases when it decides not to inline for various reasons. E.g. in C++ world, lots of things are inline, yet honoring that everywhere would mean very inefficient huge programs. If a function relies for correctness on being inlined, then it should use inline __attribute__((always_inline)).
Jakub - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |