X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=rF6GTWwXhZ0YKBSfro6R8NPIt3kUom5Lp6EJMvNRoPp 4WIKHFDVirEUCWx/6kXw7Op7A2XSNG9gTpTK+DVejDT6apIs5IwIK8oNEO5XpnTi k8OPOuoEBtqdPGtrPJLSNVxy0jxHh8eNue9Eu5oAZJ4pqKLKyU9VrrnFGBsD4+r8 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=htstYKzfMwXXxJjzBoP5MXRecdU=; b=XobrBx5p3Z1DVbZat 1xRNHeaKG+JPiXaJfdu4eBVTRwVRDjhJWg2Ecv6HnZvajRafulSfMU5P6cFANpKb pRoydK3t3/PX33HVYZlgECJOGY34809oIFTCUWuriw3I/3zgWrBIorgTQpQUkFCM GNpwQceIS7kfhIOQGZWCtj54qs= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout03.t-online.de Message-ID: <542175EF.4040703@t-online.de> Date: Tue, 23 Sep 2014 15:30:23 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 SeaMonkey/2.26.1 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: ffs problem in windows64 References: <54216D72 DOT 2070307 AT cs DOT umass DOT edu> In-Reply-To: <54216D72.2070307@cs.umass.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 = 0x80000000; >> 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(0x80000000) These work: ffs(0xc0000000) ffs(0x40000000) 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