public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* cant compile on alpha with gcc-4.3 and CONFIG_ALPHA_NAUTILUS
@ 2009-01-10 11:54 Daniel Drake
  2009-01-11 21:05 ` Ivan Kokshaysky
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Drake @ 2009-01-10 11:54 UTC (permalink / raw)
  To: Linux Kernel list; +Cc: klausman, rth

[-- 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);
-}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-12 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-10 11:54 cant compile on alpha with gcc-4.3 and CONFIG_ALPHA_NAUTILUS Daniel Drake
2009-01-11 21:05 ` Ivan Kokshaysky
2009-01-12 12:01   ` Daniel Drake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox