Re: ffs problem in windows64
On 9/23/2014 8:47 AM, Paulo César Pereira de Andrade wrote: Hi, I am almost done porting https://savannah.gnu.org/projects/lightning to cygwin and windows64 abi. But I found a problem with the ffs function. The test case is simple: $ cat x.c extern int ffs(int); int main(void) { long l = 0x8000; int i = ffs((int)l); return 0; } $ gcc -O0 -g3 x.c $ ./a.exe Segmentation fault (...) WJFFM in 32 bit cygwin. Regards -- Eliot Moss -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ffs problem in windows64
Eliot Moss wrote: On 9/23/2014 8:47 AM, Paulo César Pereira de Andrade wrote: Hi, I am almost done porting https://savannah.gnu.org/projects/lightning to cygwin and windows64 abi. But I found a problem with the ffs function. The test case is simple: $ cat x.c extern int ffs(int); int main(void) { long l = 0x8000; int i = ffs((int)l); return 0; } $ gcc -O0 -g3 x.c $ ./a.exe Segmentation fault (...) WJFFM in 32 bit cygwin. It fails under 64 bit cygwin. This segfaults if gcc -fno-builtin option is used: ffs(0x8000) These work: ffs(0xc000) ffs(0x4000) Likely a subtle problem in table based ffs() implementation in winsup/cygwin/syscalls.cc if only upper bit is set. The newlib version of ffs() works. Christian -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ffs problem in windows64
Christian Franke wrote: This segfaults if gcc -fno-builtin option is used: ffs(0x8000) These work: ffs(0xc000) ffs(0x4000) Likely a subtle problem in table based ffs() implementation in winsup/cygwin/syscalls.cc if only upper bit is set. The newlib version of ffs() works. https://cygwin.com/ml/cygwin-patches/2014-q3/msg00014.html -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple