Re: GCC 3.4 and broken inlining.
From: Adrian Bunk
Date: Thu Jul 08 2004 - 15:55:17 EST
On Thu, Jul 08, 2004 at 08:07:19AM -0400, Jakub Jelinek wrote:
> 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)).
include/linux/compiler-gcc3.h says:
<-- snip -->
#if __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4
# define inline __inline__ __attribute__((always_inline))
# define __inline__ __inline__ __attribute__((always_inline))
# define __inline __inline__ __attribute__((always_inline))
#endif
<-- snip -->
@Arjan:
This was added as part of your
[PATCH] ia32: 4Kb stacks (and irqstacks) patch
What's the recommended solution for Nigel's problem?
> Jakub
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/