diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-09-09 07:18:28 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-09-09 07:18:28 +0000 |
commit | 878887c50cccd45b5cabe6ed2ac743941f3417ea (patch) | |
tree | 29adc470d9da67b9a6ab051a2be656a54d3c524e /arch/i386 | |
parent | deb85ab44dbe784ba6174b8cf376d35aeacbe309 (diff) | |
download | musl-878887c50cccd45b5cabe6ed2ac743941f3417ea.tar.gz musl-878887c50cccd45b5cabe6ed2ac743941f3417ea.tar.bz2 musl-878887c50cccd45b5cabe6ed2ac743941f3417ea.tar.xz musl-878887c50cccd45b5cabe6ed2ac743941f3417ea.zip |
fix missing earlyclobber flag in i386 a_ctz_64 asm
this error was only found by reading the code, but it seems to have
been causing gcc to produce wrong code in malloc: the same register
was used for the output and the high word of the input. in principle
this could have caused an infinite loop searching for an available
bin, but in practice most x86 models seem to implement the "undefined"
result of the bsf instruction as "unchanged".
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/atomic.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/i386/atomic.h b/arch/i386/atomic.h index 25441df2..fd222eae 100644 --- a/arch/i386/atomic.h +++ b/arch/i386/atomic.h @@ -7,7 +7,7 @@ static inline int a_ctz_64(uint64_t x) { int r; __asm__( "bsf %1,%0 ; jnz 1f ; bsf %2,%0 ; addl $32,%0\n1:" - : "=r"(r) : "r"((unsigned)x), "r"((unsigned)(x>>32)) ); + : "=&r"(r) : "r"((unsigned)x), "r"((unsigned)(x>>32)) ); return r; } |