public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Drake <dsd@gentoo.org>
To: Linux Kernel list <linux-kernel@vger.kernel.org>
Cc: klausman@gentoo.org, rth@twiddle.net
Subject: cant compile on alpha with gcc-4.3 and CONFIG_ALPHA_NAUTILUS
Date: Sat, 10 Jan 2009 11:54:15 +0000	[thread overview]
Message-ID: <49688C67.5050502@gentoo.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

Hi,

As reported here:
http://bugs.gentoo.org/show_bug.cgi?id=254150

.config here:
http://bugs.gentoo.org/attachment.cgi?id=177958&action=view

Compile fails for the CONFIG_ALPHA_NAUTILUS systype on gcc 4.3, due to
gcc's new array bounds checking:
   CC      arch/alpha/kernel/irq_srm.o
cc1: warnings being treated as errors
arch/alpha/kernel/irq_srm.c: In function 'init_srm_irqs':
arch/alpha/kernel/irq_srm.c:69: error: array subscript is above array
bounds
arch/alpha/kernel/irq_srm.c:70: error: array subscript is above array
bounds
make[1]: *** [arch/alpha/kernel/irq_srm.o] Error 1

I was surprised to see that alpha has -Werror set, but I see that is
also true of some other architectures. Ordinarily, bounds checking is
only a warning.

gcc is both right and wrong with this warning. It is right, because
nautilus hits this in arch/alpha/include/asm/irq.h:
#else /* everyone else */
# define NR_IRQS	16
#endif

And init_srm_irqs() would clearly go above the size of the array:
	for (i = 16; i < max; ++i)

But gcc is also wrong, in that it is assuming that init_srm_irqs() would
be called with max > 16. In fact, in this configuration, init_srm_irqs()
is never called at all (but I am not sure how we could expect gcc to
know this, given that object files are compiled individually). It is
only called on two of the many alpha systypes, as far as I can see.

To fix this, we could remove -Werror or we could restructure the irq_srm
code so that it is only compiled on systems that use it. One small
function (srm_device_interrupt) is used all over the place so would have
to be separated. Patch attached, which has been compile-tested on 
nautilus. The disadvantage is that srm_device_interrupt() is now built 
on all alpha sys types, but it is so small that it doesn't seem worth 
creating its own file or creating ifdef spaghetti.

Thoughts?

Daniel


[-- Attachment #2: alpha-srm.patch --]
[-- Type: text/plain, Size: 3192 bytes --]

From: Daniel Drake <dsd@gentoo.org>
https://bugs.gentoo.org/show_bug.cgi?id=254150
Disclaimer: I know nothing about alpha!

Index: linux-2.6.28-gentoo/arch/alpha/kernel/Makefile
===================================================================
--- linux-2.6.28-gentoo.orig/arch/alpha/kernel/Makefile
+++ linux-2.6.28-gentoo/arch/alpha/kernel/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_ALPHA_TITAN)	+= core_titan.
 obj-$(CONFIG_ALPHA_WILDFIRE)	+= core_wildfire.o
 
 # Board support
-obj-$(CONFIG_ALPHA_ALCOR)	+= sys_alcor.o irq_i8259.o irq_srm.o
+obj-$(CONFIG_ALPHA_ALCOR)	+= sys_alcor.o irq_i8259.o
 obj-$(CONFIG_ALPHA_CABRIOLET)	+= sys_cabriolet.o irq_i8259.o irq_srm.o \
 				   ns87312.o
 obj-$(CONFIG_ALPHA_EB164)	+= sys_cabriolet.o irq_i8259.o irq_srm.o \
@@ -78,19 +78,19 @@ obj-$(CONFIG_ALPHA_JENSEN)	+= sys_jensen
 obj-$(CONFIG_ALPHA_MARVEL)	+= sys_marvel.o 
 obj-$(CONFIG_ALPHA_MIATA)	+= sys_miata.o irq_pyxis.o irq_i8259.o \
 				   es1888.o smc37c669.o
-obj-$(CONFIG_ALPHA_MIKASA)	+= sys_mikasa.o irq_i8259.o irq_srm.o
-obj-$(CONFIG_ALPHA_NAUTILUS)	+= sys_nautilus.o irq_i8259.o irq_srm.o
+obj-$(CONFIG_ALPHA_MIKASA)	+= sys_mikasa.o irq_i8259.o
+obj-$(CONFIG_ALPHA_NAUTILUS)	+= sys_nautilus.o irq_i8259.o
 obj-$(CONFIG_ALPHA_NORITAKE)	+= sys_noritake.o irq_i8259.o
 obj-$(CONFIG_ALPHA_RAWHIDE)	+= sys_rawhide.o irq_i8259.o
 obj-$(CONFIG_ALPHA_RUFFIAN)	+= sys_ruffian.o irq_pyxis.o irq_i8259.o
 obj-$(CONFIG_ALPHA_RX164)	+= sys_rx164.o irq_i8259.o
 obj-$(CONFIG_ALPHA_SABLE)	+= sys_sable.o
 obj-$(CONFIG_ALPHA_LYNX)	+= sys_sable.o
-obj-$(CONFIG_ALPHA_BOOK1)	+= sys_sio.o irq_i8259.o irq_srm.o ns87312.o
-obj-$(CONFIG_ALPHA_AVANTI)	+= sys_sio.o irq_i8259.o irq_srm.o ns87312.o
-obj-$(CONFIG_ALPHA_NONAME)	+= sys_sio.o irq_i8259.o irq_srm.o ns87312.o
-obj-$(CONFIG_ALPHA_P2K)		+= sys_sio.o irq_i8259.o irq_srm.o ns87312.o
-obj-$(CONFIG_ALPHA_XL)		+= sys_sio.o irq_i8259.o irq_srm.o ns87312.o
+obj-$(CONFIG_ALPHA_BOOK1)	+= sys_sio.o irq_i8259.o ns87312.o
+obj-$(CONFIG_ALPHA_AVANTI)	+= sys_sio.o irq_i8259.o ns87312.o
+obj-$(CONFIG_ALPHA_NONAME)	+= sys_sio.o irq_i8259.o ns87312.o
+obj-$(CONFIG_ALPHA_P2K)		+= sys_sio.o irq_i8259.o ns87312.o
+obj-$(CONFIG_ALPHA_XL)		+= sys_sio.o irq_i8259.o ns87312.o
 obj-$(CONFIG_ALPHA_SX164)	+= sys_sx164.o irq_pyxis.o irq_i8259.o \
 				   irq_srm.o smc37c669.o
 obj-$(CONFIG_ALPHA_TAKARA)	+= sys_takara.o irq_i8259.o ns87312.o
Index: linux-2.6.28-gentoo/arch/alpha/kernel/irq.c
===================================================================
--- linux-2.6.28-gentoo.orig/arch/alpha/kernel/irq.c
+++ linux-2.6.28-gentoo/arch/alpha/kernel/irq.c
@@ -159,3 +159,11 @@ handle_irq(int irq)
 	__do_IRQ(irq);
 	irq_exit();
 }
+
+void
+srm_device_interrupt(unsigned long vector)
+{
+	int irq = (vector - 0x800) >> 4;
+	handle_irq(irq);
+}
+
Index: linux-2.6.28-gentoo/arch/alpha/kernel/irq_srm.c
===================================================================
--- linux-2.6.28-gentoo.orig/arch/alpha/kernel/irq_srm.c
+++ linux-2.6.28-gentoo/arch/alpha/kernel/irq_srm.c
@@ -71,9 +71,3 @@ init_srm_irqs(long max, unsigned long ig
 	}
 }
 
-void 
-srm_device_interrupt(unsigned long vector)
-{
-	int irq = (vector - 0x800) >> 4;
-	handle_irq(irq);
-}

             reply	other threads:[~2009-01-10 11:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-10 11:54 Daniel Drake [this message]
2009-01-11 21:05 ` cant compile on alpha with gcc-4.3 and CONFIG_ALPHA_NAUTILUS Ivan Kokshaysky
2009-01-12 12:01   ` Daniel Drake

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=49688C67.5050502@gentoo.org \
    --to=dsd@gentoo.org \
    --cc=klausman@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox