[LLVMdev] FD_ZERO unsupported inline asm on 64 bit

Duncan Sands baldrick at free.fr
Tue Feb 16 06:44:27 PST 2010


Hi Cristian, this is (part of) bug 3373, see
   http://llvm.org/bugs/show_bug.cgi?id=3373

> 	FD_ZERO(&rfds);   //this is the error line

...

> # define __FD_ZERO(fdsp) \
>   do {                                                                        \
>     int __d0, __d1;                                                           \
>     __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS                         \
>                           : "=c" (__d0), "=D" (__d1)                          \
>                           : "a" (0), "0" (sizeof (fd_set)                     \
>                                           / sizeof (__fd_mask)),              \
>                             "1" (&__FDS_BITS (fdsp)[0])                       \
>                           : "memory");                                        \
>   } while (0)

That said, this is an odd way to implement FD_ZERO.  The crazy asm is equivalent
to a simple memset...

Ciao,

Duncan.

PS: The underlying problem here is probably that __d0 and __d1 are declared as
int, which is only 32 bits in size, while the asm is expecting 64 bits.



More information about the llvm-dev mailing list