From: Hugh Dickins <hugh@veritas.com>

Hugh was hitting compiler bugs due to the use of alloc() in the bitmap
code.  Work around it by eliminating the variable-sized arrays.



---

 25-akpm/lib/bitmap.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff -puN lib/bitmap.c~bitmap-avoid-alloca lib/bitmap.c
--- 25/lib/bitmap.c~bitmap-avoid-alloca	Mon Feb  2 12:55:52 2004
+++ 25-akpm/lib/bitmap.c	Mon Feb  2 12:55:52 2004
@@ -12,6 +12,8 @@
 #include <asm/bitops.h>
 #include <asm/uaccess.h>
 
+#define MAX_BITMAP_BITS	512U	/* for ia64 NR_CPUS maximum */
+
 int bitmap_empty(const unsigned long *bitmap, int bits)
 {
 	int k, lim = bits/BITS_PER_LONG;
@@ -73,8 +75,9 @@ void bitmap_shift_right(unsigned long *d
 			const unsigned long *src, int shift, int bits)
 {
 	int k;
-	DECLARE_BITMAP(__shr_tmp, bits);
+	DECLARE_BITMAP(__shr_tmp, MAX_BITMAP_BITS);
 
+	BUG_ON(bits > MAX_BITMAP_BITS);
 	bitmap_clear(__shr_tmp, bits);
 	for (k = 0; k < bits - shift; ++k)
 		if (test_bit(k + shift, src))
@@ -87,8 +90,9 @@ void bitmap_shift_left(unsigned long *ds
 			const unsigned long *src, int shift, int bits)
 {
 	int k;
-	DECLARE_BITMAP(__shl_tmp, bits);
+	DECLARE_BITMAP(__shl_tmp, MAX_BITMAP_BITS);
 
+	BUG_ON(bits > MAX_BITMAP_BITS);
 	bitmap_clear(__shl_tmp, bits);
 	for (k = bits; k >= shift; --k)
 		if (test_bit(k - shift, src))

_