Re: GCC 3.4 and broken inlining.

Adrian Bunk
2004-07-11T11:50:47Z

On Sun, Jul 11, 2004 at 01:32:18AM -0700, Andrew Morton wrote:
> Andi Kleen <ak@muc.de> wrote:
>...
> > > b) If the programmer didn't say "inline" then don't inline it.
> > >
> > > Surely it is not hard to add a new option to gcc to provide these semantics?
> >
> > That option is -O2 -Dinline="__attribute__((always_inline))"
> > But for some reason it was turned off for 3.4/3.5.
> >
>
> Please tell me that was just a bug, and it will be fixed very soon.

It's a bug in compiler-gcc3.h, and I already sent the patch below in
this thread.

I'm currently sending fixes for compile errors this causes with gcc 3.4
(I've forgotten the exact number, but there were compile errors in at
about 30 files in a full i386 compile).

<-- snip -->

[patch] #define inline as __attribute__((always_inline)) also for gcc >= 3.4

Rationale:
- if gcc 3.4 can't inline a function marked as "inline" that's a
strong hint that further investigation is required
- I strongly prefer a compile error over a potential runtime problem

Signed-off-by: Adrian Bunk <bunk@fs.tum.de>

--- linux-2.6.7-mm6-full-gcc3.4/include/linux/compiler-gcc3.h.old 2004-07-08 23:40:27.000000000 +0200
+++ linux-2.6.7-mm6-full-gcc3.4/include/linux/compiler-gcc3.h 2004-07-08 23:40:37.000000000 +0200
@@ -3,7 +3,7 @@
/* These definitions are for GCC v3.x. */
#include <linux/compiler-gcc.h>

-#if __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4
+#if __GNUC_MINOR__ >= 1
# define inline __inline__ __attribute__((always_inline))
# define __inline__ __inline__ __attribute__((always_inline))
# define __inline __inline__ __attribute__((always_inline))