All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mahatma@eu.by
Cc: Dzianis Kahanovich <mahatma@bspu.unibel.by>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix miscompiling with GCC 4.5 -finline-functions
Date: Wed, 5 Jan 2011 15:02:26 -0800	[thread overview]
Message-ID: <20110105150226.f4e2f31e.akpm@linux-foundation.org> (raw)
In-Reply-To: <4D2339F7.3090502@bspu.unibel.by>

On Tue, 04 Jan 2011 17:17:11 +0200
Dzianis Kahanovich <mahatma@bspu.unibel.by> wrote:

> Fixing broken automatic inlining for GCC 4.5+  (breaks build with
> -finline-functions or -O3 on x86_*).
> 

Please always quote the compiler output when addressing build errors
and warnings.

> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -569,7 +569,7 @@ static inline void ept_sync_individual_a
>  	}
>  }
> 
> -static unsigned long vmcs_readl(unsigned long field)
> +static noinline unsigned long vmcs_readl(unsigned long field)
>  {
>  	unsigned long value = 0;
> 
> --- a/drivers/media/radio/radio-aimslab.c
> +++ b/drivers/media/radio/radio-aimslab.c
> @@ -71,7 +71,7 @@ static struct rtrack rtrack_card;
> 
>  /* local things */
> 
> -static void sleep_delay(long n)
> +static noinline void sleep_delay(long n)
>  {
>  	/* Sleep nicely for 'n' uS */
>  	int d = n / msecs_to_jiffies(1000);

A golden rule is that when a programmer reads some code, he should be
able to understand why it's there.  There is no way on this little
earth that a programmer will be able to look at this code and say
"ah-hah, that must be a workaround for gcc-4.5 -finline-functions!".

We fix that problem this way:

--- a/arch/x86/kvm/vmx.c~fix-miscompiling-with-gcc-45-finline-functions-fix
+++ a/arch/x86/kvm/vmx.c
@@ -569,6 +569,7 @@ static inline void ept_sync_individual_a
 	}
 }
 
+/* noinline works around gcc-4.5+ build error with -finline-functions */
 static noinline unsigned long vmcs_readl(unsigned long field)
 {
 	unsigned long value = 0;
--- a/drivers/media/radio/radio-aimslab.c~fix-miscompiling-with-gcc-45-finline-functions-fix
+++ a/drivers/media/radio/radio-aimslab.c
@@ -71,6 +71,7 @@ static struct rtrack rtrack_card;
 
 /* local things */
 
+/* noinline works around gcc-4.5+ build error with -finline-functions */
 static noinline void sleep_delay(long n)
 {
 	/* Sleep nicely for 'n' uS */
_


  reply	other threads:[~2011-01-05 23:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04 15:17 [PATCH] fix miscompiling with GCC 4.5 -finline-functions Dzianis Kahanovich
2011-01-05 23:02 ` Andrew Morton [this message]
2011-01-06 17:42   ` Dzianis Kahanovich
2011-01-06 18:07     ` Arnaud Lacombe
2011-01-08  1:02       ` mahatma
2011-01-08  1:05       ` Denis Kaganovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110105150226.f4e2f31e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahatma@bspu.unibel.by \
    --cc=mahatma@eu.by \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.