Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 14 Dec 2012 13:40:26 +0100
From: Szabolcs Nagy <>
Subject: Re: spandsp build, lrint/sqrt/pow issue

* 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)

View attachment "tg.diff" of type "text/x-diff" (1781 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.