[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <49688C67.5050502@gentoo.org>
Date: Sat, 10 Jan 2009 11:54:15 +0000
From: Daniel Drake <dsd@...too.org>
To: Linux Kernel list <linux-kernel@...r.kernel.org>
CC: klausman@...too.org, rth@...ddle.net
Subject: cant compile on alpha with gcc-4.3 and CONFIG_ALPHA_NAUTILUS
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
View attachment "alpha-srm.patch" of type "text/plain" (3193 bytes)
Powered by blists - more mailing lists