Messages in this thread | | | Date | Wed, 15 Oct 2003 21:10:12 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH][2.6] constant_test_bit doesn't like my gcc |
| |
Zwane Mwaikambo <zwane@arm.linux.org.uk> wrote: > > 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...
The volatile is rather important.
static inline int constant_test_bit(int nr, const unsigned long *addr) { return ((1UL << (nr & 31)) & (((const unsigned long *) addr)[nr >> 5])) != 0; }
foo(unsigned long *p) { while (constant_test_bit(0, p)) ; }
.file "a.c" .text .align 2 .p2align 2,,3 .globl foo .type foo,@function foo: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax testb $1, (%eax) .p2align 2,,3 .L2: jne .L2 leave ret .Lfe1: .size foo,.Lfe1-foo .ident "GCC: (GNU) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)"
See, the little busywait loop doesn't reevaluate the test each time around: it locks up instead.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |