All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][2.6] constant_test_bit doesn't like my gcc
@ 2003-10-16  3:13 Zwane Mwaikambo
  2003-10-16  4:10 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Zwane Mwaikambo @ 2003-10-16  3:13 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Andrew Morton

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2229 bytes --]

cpu_has_foo and friends don't work at all with my gcc 3.2.2-5 and i'm 
branching off into all sorts of tests (which is another story...). i also 
took the liberty of removing the const volatile...

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --with-system-zlib --enable-__cxa_atexit 
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

0x08048328 <main+0>:    push   %ebp
0x08048329 <main+1>:    mov    %esp,%ebp
0x0804832b <main+3>:    sub    $0x8,%esp
0x0804832e <main+6>:    mov    0xfffffffc(%ebp),%eax
0x08048331 <main+9>:    and    $0xfffffff0,%esp
0x08048334 <main+12>:   shr    $0x3,%eax
0x08048337 <main+15>:   sub    $0x8,%esp
0x0804833a <main+18>:   and    $0x1,%eax
0x0804833d <main+21>:   push   %eax
0x0804833e <main+22>:   push   $0x8048400
0x08048343 <main+27>:   movl   $0xff,0xfffffffc(%ebp)
0x0804834a <main+34>:   call   0x8048268 <printf>
0x0804834f <main+39>:   xor    %eax,%eax
0x08048351 <main+41>:   leave

Index: linux-2.6.0-test7-mm1/include/asm-i386/bitops.h
===================================================================
RCS file: /build/cvsroot/linux-2.6.0-test7-mm1/include/asm-i386/bitops.h,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 bitops.h
--- linux-2.6.0-test7-mm1/include/asm-i386/bitops.h	15 Oct 2003 09:02:10 -0000	1.1.1.1
+++ linux-2.6.0-test7-mm1/include/asm-i386/bitops.h	16 Oct 2003 03:04:34 -0000
@@ -239,12 +239,12 @@ static __inline__ int test_and_change_bi
 static int test_bit(int nr, const volatile void * addr);
 #endif
 
-static __inline__ int constant_test_bit(int nr, const volatile unsigned long * addr)
+static __inline__ int constant_test_bit(int nr, const unsigned long * addr)
 {
-	return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
+	return ((1UL << (nr & 31)) & (((const unsigned long *) addr)[nr >> 5])) != 0;
 }
 
-static __inline__ int variable_test_bit(int nr, const volatile unsigned long * addr)
+static __inline__ int variable_test_bit(int nr, const unsigned long * addr)
 {
 	int oldbit;
 

[-- Attachment #2: Type: TEXT/PLAIN, Size: 368 bytes --]

#include <stdio.h>

static int __inline__ constant_test_bit(int nr, const volatile unsigned long * addr)
{
	return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
}

int main()
{
	unsigned long foo[2];
	*foo = 0xff;
	foo[1] = 0xff;

	printf("%d %d\n", constant_test_bit(3, foo), constant_test_bit(33, foo));
	return 0;
}

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

end of thread, other threads:[~2003-10-16 22:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-16  3:13 [PATCH][2.6] constant_test_bit doesn't like my gcc Zwane Mwaikambo
2003-10-16  4:10 ` Andrew Morton
2003-10-16  4:12   ` Zwane Mwaikambo
2003-10-16  4:21     ` Andrew Morton
2003-10-16  4:22       ` Zwane Mwaikambo
2003-10-16 10:55         ` Ingo Oeser
2003-10-16 14:55           ` Andrew Morton
2003-10-16 21:58           ` bill davidsen

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.