From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2470 Path: news.gmane.org!not-for-mail From: ojab Newsgroups: gmane.linux.lib.musl.general Subject: Re: spandsp build, lrint/sqrt/pow issue Date: Fri, 14 Dec 2012 16:59:57 +0400 Message-ID: <50CB22CD.1070208@ojab.ru> References: <50CAF645.9000804@ojab.ru> <20121214124026.GO23126@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1355490015 1082 80.91.229.3 (14 Dec 2012 13:00:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Dec 2012 13:00:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2471-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 14 14:00:26 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TjUsL-0007Wy-9L for gllmg-musl@plane.gmane.org; Fri, 14 Dec 2012 14:00:25 +0100 Original-Received: (qmail 12098 invoked by uid 550); 14 Dec 2012 13:00:12 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 12090 invoked from network); 14 Dec 2012 13:00:12 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=MDcsyhnJKognK9/X1xjZbFPRjwejfACS7eKAhIBwtXw=; b=EytKwFtfk76QNRE3oojXpp/L/Mi+qpYUm+q+m0T8/ASE/Vq7XeJeC1CBkw7xqQOuij qaAtq/70H6vC3hhpMirbC9eiXWxJar6CxzrbdUfm2crXPtONz7PWYcfrhegWzs290lVG KF4npcoM5yS4NdT9GGvjxHDkOGg/7U3AlgJhi8STZrVx1igyTnGc3ZqAWqCUZuNwDE78 qeWcKMV/Axn1JdTmfZgoWhSNSqwMRXXw3zkaiRB5GkronoeYC2ZrI9d0LoHJXcjP9V9p Mtk9dSXcg/CdpP/QZQvGQCjDjfe3clJU78L+oqjPBH3kkiiqMviOw9WpPyiUR28aS0uE WhDg== User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Thunderbird/20.0a1 In-Reply-To: <20121214124026.GO23126@port70.net> X-Gm-Message-State: ALoCoQmIe4esQDBY29lE86OIv7x1qOi2F3p69u75nL2v9qJZay1RbKmIDR/C0gg0slQY9QY9MCgg Xref: news.gmane.org gmane.linux.lib.musl.general:2470 Archived-At: On 14.12.2012 16:40, Szabolcs Nagy wrote: > * ojab [2012-12-14 13:49:57 +0400]: >> spandsp library (which is used in FreeSWITCH/Asterisk/Yate/many >> commercial solutions/etc) build fails with (first error): >> >>> In file included from awgn.c:59:0: >>> spandsp/saturated.h: In function 'fsaturate': >>> spandsp/saturated.h:184:22: warning: cast to pointer from integer of different size >>> spandsp/saturated.h:184:22: warning: cast to pointer from integer of different size >>> spandsp/saturated.h:184:5: error: invalid use of void expression >> >> line 184 is return statement in >>> static __inline__ int16_t fsaturate(double damp) >>> { >>> if (damp > (double) INT16_MAX) >>> return INT16_MAX; >>> if (damp < (double) INT16_MIN) >>> return INT16_MIN; >>> return (int16_t) lrint(damp); >>> } > > this is a bug in musl's tgmath.h > (incorrectly casted the return value to a floating-point type) > > thanks for catching it, i pushed a fix to my math repo > (also attached) > >> awgn.i can be found in the attached file. The same errors happens >> with pow() and sqrt() functions. > > i don't see problems with pow or sqrt > > they seem to use sqrt(log(something)) which expands to a very > long expression, but otherwise it should work > > actually they shouldn't use tgmath.h at all > (it could be useful if they used a custom floating-point type that > is typedefed to float,double or long double in some header, but > they seem to use plain doubles everywhere) > > so you can fix the issue by replacing tgmath.h with math.h in that file > (and maybe report the issue upstream, tgmath.h is a header > that is hard to get right, can cause cryptic error messages, > and is very rarely used, so it should be avoided when possible) > Thanks for the quick fix, lrint issue is fixed. Right now build fails only on sqrt() and pow(): awgn.c: In function 'awgn_init_dbov': awgn.c:109:14: warning: cast to pointer from integer of different size awgn.c:109:14: warning: cast to pointer from integer of different size awgn.c:109:14: warning: cast to pointer from integer of different size awgn.c:109:5: error: void value not ignored as it ought to be and line 109: s->rms = pow(10.0, level/20.0)*32768.0; Next issue is awgn.c: In function 'awgn': awgn.c:165:15: warning: cast to pointer from integer of different size awgn.c:165:15: warning: cast to pointer from integer of different size awgn.c:165:9: error: void value not ignored as it ought to be awgn.c:165:9: warning: type defaults to 'int' in type name and line 165: fac = sqrt(-2.0*log(r)/r); So I suppose the fix is needed (don't know if it should be on musl side though). spandsp use tgmath.h only if available, so if I'll remove tgmath.h or undefine HAVE_TGMATH_H — spandsp builds fine. //wbr ojab