mailing list of musl libc
 help / color / mirror / code / Atom feed
* spandsp build, lrint/sqrt/pow issue
@ 2012-12-14  9:49 ojab
  2012-12-14 12:40 ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: ojab @ 2012-12-14  9:49 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]

Hi list,

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);
> }

awgn.i can be found in the attached file. The same errors happens with 
pow() and sqrt() functions.

Unfortunately my knowledge is insufficient to debug further (because I 
don't quite understand how lrint() can unfold to that), please assist.

I'm using sabotage-0.9.7 x86_64 image with musl updated to 0.9.8 (you 
can download it http://ojab.ru/sabotage-0.9.7-x86_64_spandsp.img.xz and 
`cd ~/spandsp && make`), please drop me a private mail if the ssh access 
to qemu instance is needed.

//wbr ojab



[-- Attachment #2: awgn.i --]
[-- Type: text/plain, Size: 62900 bytes --]

# 1 "awgn.c"
# 1 "/root/spandsp/src//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "awgn.c"
# 44 "awgn.c"
# 1 "config.h" 1
# 45 "awgn.c" 2


# 1 "/usr/include/stdlib.h" 1 3 4







# 1 "/usr/include/features.h" 1 3 4
# 9 "/usr/include/stdlib.h" 2 3 4
# 20 "/usr/include/stdlib.h" 3 4
# 1 "/usr/include/bits/alltypes.h" 1 3 4


typedef unsigned long size_t;
# 25 "/usr/include/bits/alltypes.h" 3 4
typedef int wchar_t;
# 21 "/usr/include/stdlib.h" 2 3 4

int atoi (const char *);
long atol (const char *);
long long atoll (const char *);
double atof (const char *);

float strtof (const char *restrict, char **restrict);
double strtod (const char *restrict, char **restrict);
long double strtold (const char *restrict, char **restrict);

long strtol (const char *restrict, char **restrict, int);
unsigned long strtoul (const char *restrict, char **restrict, int);
long long strtoll (const char *restrict, char **restrict, int);
unsigned long long strtoull (const char *restrict, char **restrict, int);

int rand (void);
void srand (unsigned);

void *malloc (size_t);
void *calloc (size_t, size_t);
void *realloc (void *, size_t);
void free (void *);
void *aligned_alloc(size_t alignment, size_t size);

__attribute__((__noreturn__)) void abort (void);
int atexit (void (*) (void));
__attribute__((__noreturn__)) void exit (int);
__attribute__((__noreturn__)) void _Exit (int);
int at_quick_exit (void (*) (void));
__attribute__((__noreturn__)) void quick_exit (int);

char *getenv (const char *);

int system (const char *);

void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));

int abs (int);
long labs (long);
long long llabs (long long);

typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
typedef struct { long long quot, rem; } lldiv_t;

div_t div (int, int);
ldiv_t ldiv (long, long);
lldiv_t lldiv (long long, long long);

int mblen (const char *, size_t);
int mbtowc (wchar_t *restrict, const char *restrict, size_t);
int wctomb (char *, wchar_t);
size_t mbstowcs (wchar_t *restrict, const char *restrict, size_t);
size_t wcstombs (char *restrict, const wchar_t *restrict, size_t);
# 99 "/usr/include/stdlib.h" 3 4
int posix_memalign (void **, size_t, size_t);
int setenv (const char *, const char *, int);
int unsetenv (const char *);
int mkstemp (char *);
char *mkdtemp (char *);
int getsubopt (char **, char *const *, char **);
int rand_r (unsigned *);






char *realpath (const char *restrict, char *restrict);
long int random (void);
void srandom (unsigned int);
char *initstate (unsigned int, char *, size_t);
char *setstate (char *);



int putenv (char *);
int posix_openpt (int);
int grantpt (int);
int unlockpt (int);
char *ptsname (int);
char *l64a (long);
long a64l (const char *);
void setkey (const char *);
double drand48 (void);
double erand48 (unsigned short [3]);
long int lrand48 (void);
long int nrand48 (unsigned short [3]);
long mrand48 (void);
long jrand48 (unsigned short [3]);
void srand48 (long);
unsigned short *seed48 (unsigned short [3]);
void lcong48 (unsigned short [7]);



# 1 "/usr/include/alloca.h" 1 3 4
# 9 "/usr/include/alloca.h" 3 4
# 1 "/usr/include/bits/alltypes.h" 1 3 4
# 10 "/usr/include/alloca.h" 2 3 4

void *alloca(size_t);
# 141 "/usr/include/stdlib.h" 2 3 4
char *mktemp (char *);
void *valloc (size_t);
void *memalign(size_t, size_t);
# 48 "awgn.c" 2
# 1 "/usr/include/inttypes.h" 1 3 4
# 9 "/usr/include/inttypes.h" 3 4
# 1 "/opt/gcc4/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.4/include/stdint.h" 1 3 4


# 1 "/usr/include/stdint.h" 1 3 4
# 27 "/usr/include/stdint.h" 3 4
# 1 "/usr/include/bits/alltypes.h" 1 3 4
# 47 "/usr/include/bits/alltypes.h" 3 4
typedef signed char int8_t;




typedef short int16_t;




typedef int int32_t;




typedef long int64_t;





typedef unsigned char uint8_t;




typedef unsigned short uint16_t;




typedef unsigned int uint32_t;




typedef unsigned long uint64_t;
# 105 "/usr/include/bits/alltypes.h" 3 4
typedef int8_t int_fast8_t;




typedef int int_fast16_t;




typedef int int_fast32_t;




typedef int64_t int_fast64_t;





typedef unsigned char uint_fast8_t;




typedef unsigned int uint_fast16_t;




typedef unsigned int uint_fast32_t;




typedef uint64_t uint_fast64_t;





typedef long intptr_t;




typedef unsigned long uintptr_t;
# 28 "/usr/include/stdint.h" 2 3 4

typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;

typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;

typedef long long intmax_t;
typedef unsigned long long uintmax_t;
# 81 "/usr/include/stdint.h" 3 4
# 1 "/usr/include/bits/wchar.h" 1 3 4
# 82 "/usr/include/stdint.h" 2 3 4
# 1 "/usr/include/bits/stdint.h" 1 3 4
# 83 "/usr/include/stdint.h" 2 3 4
# 4 "/opt/gcc4/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.4/include/stdint.h" 2 3 4
# 10 "/usr/include/inttypes.h" 2 3 4


# 1 "/usr/include/bits/alltypes.h" 1 3 4
# 13 "/usr/include/inttypes.h" 2 3 4

typedef struct { intmax_t quot, rem; } imaxdiv_t;

intmax_t imaxabs(intmax_t);
imaxdiv_t imaxdiv(intmax_t, intmax_t);

intmax_t strtoimax(const char *restrict, char **restrict, int);
uintmax_t strtoumax(const char *restrict, char **restrict, int);

intmax_t wcstoimax(const wchar_t *restrict, wchar_t **restrict, int);
uintmax_t wcstoumax(const wchar_t *restrict, wchar_t **restrict, int);
# 49 "awgn.c" 2

# 1 "/usr/include/tgmath.h" 1 3 4
# 13 "/usr/include/tgmath.h" 3 4
# 1 "/usr/include/math.h" 1 3 4
# 15 "/usr/include/math.h" 3 4
# 1 "/usr/include/bits/alltypes.h" 1 3 4
# 89 "/usr/include/bits/alltypes.h" 3 4
typedef unsigned short __uint16_t;




typedef unsigned int __uint32_t;




typedef unsigned long __uint64_t;
# 158 "/usr/include/bits/alltypes.h" 3 4
typedef double float_t;




typedef double double_t;
# 16 "/usr/include/math.h" 2 3 4
# 42 "/usr/include/math.h" 3 4
int __fpclassify(double);
int __fpclassifyf(float);
int __fpclassifyl(long double);

union __float_repr { float __f; __uint32_t __i; };
union __double_repr { double __f; __uint64_t __i; };
# 77 "/usr/include/math.h" 3 4
int __signbit(double);
int __signbitf(float);
int __signbitl(long double);
# 92 "/usr/include/math.h" 3 4
static inline int __islessf(float __x, float __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x < __y; }
static inline int __isless(double __x, double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x < __y; }
static inline int __islessl(long double __x, long double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x < __y; }
static inline int __islessequalf(float __x, float __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x <= __y; }
static inline int __islessequal(double __x, double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x <= __y; }
static inline int __islessequall(long double __x, long double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x <= __y; }
static inline int __islessgreaterf(float __x, float __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x != __y; }
static inline int __islessgreater(double __x, double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x != __y; }
static inline int __islessgreaterl(long double __x, long double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x != __y; }
static inline int __isgreaterf(float __x, float __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x > __y; }
static inline int __isgreater(double __x, double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x > __y; }
static inline int __isgreaterl(long double __x, long double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x > __y; }
static inline int __isgreaterequalf(float __x, float __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x >= __y; }
static inline int __isgreaterequal(double __x, double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x >= __y; }
static inline int __isgreaterequall(long double __x, long double __y) { return !(( sizeof((__x)) == sizeof(float) ? ((((union __float_repr){ (float)((__x)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__x)) == sizeof(double) ? ((((union __double_repr){ (double)((__x)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__x)) == 0) ? ((void)(__y),1) : ( sizeof((__y)) == sizeof(float) ? ((((union __float_repr){ (float)((__y)) }).__i) & 0x7fffffff) > 0x7f800000 : sizeof((__y)) == sizeof(double) ? ((((union __double_repr){ (double)((__y)) }).__i) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : __fpclassifyl((__y)) == 0)) && __x >= __y; }
# 119 "/usr/include/math.h" 3 4
double acos(double);
float acosf(float);
long double acosl(long double);

double acosh(double);
float acoshf(float);
long double acoshl(long double);

double asin(double);
float asinf(float);
long double asinl(long double);

double asinh(double);
float asinhf(float);
long double asinhl(long double);

double atan(double);
float atanf(float);
long double atanl(long double);

double atan2(double, double);
float atan2f(float, float);
long double atan2l(long double, long double);

double atanh(double);
float atanhf(float);
long double atanhl(long double);

double cbrt(double);
float cbrtf(float);
long double cbrtl(long double);

double ceil(double);
float ceilf(float);
long double ceill(long double);

double copysign(double, double);
float copysignf(float, float);
long double copysignl(long double, long double);

double cos(double);
float cosf(float);
long double cosl(long double);

double cosh(double);
float coshf(float);
long double coshl(long double);

double erf(double);
float erff(float);
long double erfl(long double);

double erfc(double);
float erfcf(float);
long double erfcl(long double);

double exp(double);
float expf(float);
long double expl(long double);

double exp2(double);
float exp2f(float);
long double exp2l(long double);

double expm1(double);
float expm1f(float);
long double expm1l(long double);

double fabs(double);
float fabsf(float);
long double fabsl(long double);

double fdim(double, double);
float fdimf(float, float);
long double fdiml(long double, long double);

double floor(double);
float floorf(float);
long double floorl(long double);

double fma(double, double, double);
float fmaf(float, float, float);
long double fmal(long double, long double, long double);

double fmax(double, double);
float fmaxf(float, float);
long double fmaxl(long double, long double);

double fmin(double, double);
float fminf(float, float);
long double fminl(long double, long double);

double fmod(double, double);
float fmodf(float, float);
long double fmodl(long double, long double);

double frexp(double, int *);
float frexpf(float, int *);
long double frexpl(long double, int *);

double hypot(double, double);
float hypotf(float, float);
long double hypotl(long double, long double);

int ilogb(double);
int ilogbf(float);
int ilogbl(long double);

double ldexp(double, int);
float ldexpf(float, int);
long double ldexpl(long double, int);

double lgamma(double);
float lgammaf(float);
long double lgammal(long double);

long long llrint(double);
long long llrintf(float);
long long llrintl(long double);

long long llround(double);
long long llroundf(float);
long long llroundl(long double);

double log(double);
float logf(float);
long double logl(long double);

double log10(double);
float log10f(float);
long double log10l(long double);

double log1p(double);
float log1pf(float);
long double log1pl(long double);

double log2(double);
float log2f(float);
long double log2l(long double);

double logb(double);
float logbf(float);
long double logbl(long double);

long lrint(double);
long lrintf(float);
long lrintl(long double);

long lround(double);
long lroundf(float);
long lroundl(long double);

double modf(double, double *);
float modff(float, float *);
long double modfl(long double, long double *);

double nan(const char *);
float nanf(const char *);
long double nanl(const char *);

double nearbyint(double);
float nearbyintf(float);
long double nearbyintl(long double);

double nextafter(double, double);
float nextafterf(float, float);
long double nextafterl(long double, long double);

double nexttoward(double, long double);
float nexttowardf(float, long double);
long double nexttowardl(long double, long double);

double pow(double, double);
float powf(float, float);
long double powl(long double, long double);

double remainder(double, double);
float remainderf(float, float);
long double remainderl(long double, long double);

double remquo(double, double, int *);
float remquof(float, float, int *);
long double remquol(long double, long double, int *);

double rint(double);
float rintf(float);
long double rintl(long double);

double round(double);
float roundf(float);
long double roundl(long double);

double scalbln(double, long);
float scalblnf(float, long);
long double scalblnl(long double, long);

double scalbn(double, int);
float scalbnf(float, int);
long double scalbnl(long double, int);

double sin(double);
float sinf(float);
long double sinl(long double);

double sinh(double);
float sinhf(float);
long double sinhl(long double);

double sqrt(double);
float sqrtf(float);
long double sqrtl(long double);

double tan(double);
float tanf(float);
long double tanl(long double);

double tanh(double);
float tanhf(float);
long double tanhl(long double);

double tgamma(double);
float tgammaf(float);
long double tgammal(long double);

double trunc(double);
float truncf(float);
long double truncl(long double);
# 367 "/usr/include/math.h" 3 4
extern int signgam;

double j0(double);
double j1(double);
double jn(int, double);

double y0(double);
double y1(double);
double yn(int, double);





double scalb(double, double);
float scalbf(float, float);

double significand(double);
float significandf(float);

double lgamma_r(double, int*);
float lgammaf_r(float, int*);

float j0f(float);
float j1f(float);
float jnf(int, float);

float y0f(float);
float y1f(float);
float ynf(int, float);
# 14 "/usr/include/tgmath.h" 2 3 4
# 1 "/usr/include/complex.h" 1 3 4
# 16 "/usr/include/complex.h" 3 4
double _Complex cacos(double _Complex);
float _Complex cacosf(float _Complex);
long double _Complex cacosl(long double _Complex);

double _Complex casin(double _Complex);
float _Complex casinf(float _Complex);
long double _Complex casinl(long double _Complex);

double _Complex catan(double _Complex);
float _Complex catanf(float _Complex);
long double _Complex catanl(long double _Complex);

double _Complex ccos(double _Complex);
float _Complex ccosf(float _Complex);
long double _Complex ccosl(long double _Complex);

double _Complex csin(double _Complex);
float _Complex csinf(float _Complex);
long double _Complex csinl(long double _Complex);

double _Complex ctan(double _Complex);
float _Complex ctanf(float _Complex);
long double _Complex ctanl(long double _Complex);

double _Complex cacosh(double _Complex);
float _Complex cacoshf(float _Complex);
long double _Complex cacoshl(long double _Complex);

double _Complex casinh(double _Complex);
float _Complex casinhf(float _Complex);
long double _Complex casinhl(long double _Complex);

double _Complex catanh(double _Complex);
float _Complex catanhf(float _Complex);
long double _Complex catanhl(long double _Complex);

double _Complex ccosh(double _Complex);
float _Complex ccoshf(float _Complex);
long double _Complex ccoshl(long double _Complex);

double _Complex csinh(double _Complex);
float _Complex csinhf(float _Complex);
long double _Complex csinhl(long double _Complex);

double _Complex ctanh(double _Complex);
float _Complex ctanhf(float _Complex);
long double _Complex ctanhl(long double _Complex);

double _Complex cexp(double _Complex);
float _Complex cexpf(float _Complex);
long double _Complex cexpl(long double _Complex);

double _Complex clog(double _Complex);
float _Complex clogf(float _Complex);
long double _Complex clogl(long double _Complex);

double cabs(double _Complex);
float cabsf(float _Complex);
long double cabsl(long double _Complex);

double _Complex cpow(double _Complex, double _Complex);
float _Complex cpowf(float _Complex, float _Complex);
long double _Complex cpowl(long double _Complex, long double _Complex);

double _Complex csqrt(double _Complex);
float _Complex csqrtf(float _Complex);
long double _Complex csqrtl(long double _Complex);

double carg(double _Complex);
float cargf(float _Complex);
long double cargl(long double _Complex);

double cimag(double _Complex);
float cimagf(float _Complex);
long double cimagl(long double _Complex);

double _Complex conj(double _Complex);
float _Complex conjf(float _Complex);
long double _Complex conjl(long double _Complex);

double _Complex cproj(double _Complex);
float _Complex cprojf(float _Complex);
long double _Complex cprojl(long double _Complex);

double creal(double _Complex);
float crealf(float _Complex);
long double creall(long double _Complex);
# 15 "/usr/include/tgmath.h" 2 3 4
# 51 "awgn.c" 2




# 1 "floating_fudge.h" 1
# 56 "awgn.c" 2

# 1 "spandsp/telephony.h" 1
# 59 "spandsp/telephony.h"
typedef int (*span_rx_handler_t)(void *s, const int16_t amp[], int len);


typedef int (*span_mod_handler_t)(void *s, int16_t amp[], int len);


typedef int (*span_rx_fillin_handler_t)(void *s, int len);


typedef int (*span_tx_handler_t)(void *s, int16_t amp[], int max_len);
# 58 "awgn.c" 2
# 1 "spandsp/fast_convert.h" 1
# 189 "spandsp/fast_convert.h"
    static __inline__ long int lfastrint(double x)
    {
        return (long int) (x);
    }

    static __inline__ long int lfastrintf(float x)
    {
        return (long int) (x);
    }
# 59 "awgn.c" 2
# 1 "spandsp/saturated.h" 1
# 46 "spandsp/saturated.h"
static __inline__ int16_t saturate(int32_t amp)
{
# 58 "spandsp/saturated.h"
    int16_t z;


    z = (int16_t) amp;
    if (amp == z)
        return z;
    if (amp > (0x7fff))
        return (0x7fff);
    return (-1-0x7fff);

}


static __inline__ int16_t saturate16(int32_t amp)
{
# 83 "spandsp/saturated.h"
    int16_t z;


    z = (int16_t) amp;
    if (amp == z)
        return z;
    if (amp > (0x7fff))
        return (0x7fff);
    return (-1-0x7fff);

}



static __inline__ int16_t saturate15(int32_t amp)
{
# 109 "spandsp/saturated.h"
    if (amp > 16383)
        return 16383;
    if (amp < -16384)
        return -16384;
    return (int16_t) amp;

}


static __inline__ uint16_t saturateu16(int32_t amp)
{
# 130 "spandsp/saturated.h"
    uint16_t z;


    z = (uint16_t) amp;
    if (amp == z)
        return z;
    if (amp > (0xffff))
        return (0xffff);
    return 0;

}


static __inline__ uint8_t saturateu8(int32_t amp)
{
# 155 "spandsp/saturated.h"
    uint8_t z;


    z = (uint8_t) amp;
    if (amp == z)
        return z;
    if (amp > (0xff))
        return (0xff);
    return 0;

}


static __inline__ int16_t fsaturatef(float famp)
{
    if (famp > (float) (0x7fff))
        return (0x7fff);
    if (famp < (float) (-1-0x7fff))
        return (-1-0x7fff);
    return (int16_t) lrintf(famp);
}


static __inline__ int16_t fsaturate(double damp)
{
    if (damp > (double) (0x7fff))
        return (0x7fff);
    if (damp < (double) (-1-0x7fff))
        return (-1-0x7fff);
    return (int16_t) ((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((damp)))/2)))0 : (__typeof__(0 ? (__typeof__((damp)) *)0 : (void *)!!!((1?1:((damp)))/2)))0 )))( ((!!((1?1:((damp)))/2) && 2*sizeof((damp)) == sizeof(((damp))+(__extension__ 1.0fi))) && sizeof((damp)) == sizeof(float)) ? lrintf ((damp)) : ((!!((1?1:((damp)))/2) && 2*sizeof((damp)) == sizeof(((damp))+(__extension__ 1.0fi))) && sizeof((damp)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? lrintl ((damp)) : lrint((damp)) ));
}



static __inline__ int16_t ffastsaturatef(float famp)
{
    if (famp > (float) (0x7fff))
        return (0x7fff);
    if (famp < (float) (-1-0x7fff))
        return (-1-0x7fff);
    return (int16_t) lfastrintf(famp);
}



static __inline__ int16_t ffastsaturate(double damp)
{
    if (damp > (double) (0x7fff))
        return (0x7fff);
    if (damp < (double) (-1-0x7fff))
        return (-1-0x7fff);
    return (int16_t) lfastrint(damp);
}



static __inline__ float ffsaturatef(float famp)
{
    if (famp > (float) (0x7fff))
        return (float) (0x7fff);
    if (famp < (float) (-1-0x7fff))
        return (float) (-1-0x7fff);
    return famp;
}



static __inline__ double ffsaturate(double famp)
{
    if (famp > (double) (0x7fff))
        return (double) (0x7fff);
    if (famp < (double) (-1-0x7fff))
        return (double) (-1-0x7fff);
    return famp;
}


static __inline__ int16_t saturated_add16(int16_t a, int16_t b)
{

    __asm__ __volatile__(
        " addw %2,%0;\n"
        " jno 0f;\n"
        " movw $0x7fff,%0;\n"
        " adcw $0,%0;\n"
        "0:"
        : "=r" (a)
        : "0" (a), "ir" (b)
        : "cc"
    );
    return a;
# 258 "spandsp/saturated.h"
}


static __inline__ int32_t saturated_add32(int32_t a, int32_t b)
{

    __asm__ __volatile__(
        " addl %2,%0;\n"
        " jno 0f;\n"
        " movl $0x7fffffff,%0;\n"
        " adcl $0,%0;\n"
        "0:"
        : "=r" (a)
        : "0" (a), "ir" (b)
        : "cc"
    );
    return a;
# 295 "spandsp/saturated.h"
}


static __inline__ int16_t saturated_sub16(int16_t a, int16_t b)
{

    __asm__ __volatile__(
        " subw %2,%0;\n"
        " jno 0f;\n"
        " movw $0x8000,%0;\n"
        " sbbw $0,%0;\n"
        "0:"
        : "=r" (a)
        : "0" (a), "ir" (b)
        : "cc"
    );
    return a;
# 324 "spandsp/saturated.h"
}


static __inline__ int32_t saturated_sub32(int32_t a, int32_t b)
{

    __asm__ __volatile__(
        " subl %2,%0;\n"
        " jno 0f;\n"
        " movl $0x80000000,%0;\n"
        " sbbl $0,%0;\n"
        "0:"
        : "=r" (a)
        : "0" (a), "ir" (b)
        : "cc"
    );
    return a;
# 361 "spandsp/saturated.h"
}


static __inline__ int16_t saturated_mul16(int16_t a, int16_t b)
{
    if (a == (-1-0x7fff) && b == (-1-0x7fff))
        return (0x7fff);

    return (int16_t) (((int32_t) a*(int32_t) b) >> 15);
}


static __inline__ int32_t saturated_mul16_32(int16_t a, int16_t b)
{
    return ((int32_t) a*(int32_t) b) << 1;
}


static __inline__ int16_t saturated_abs16(int16_t a)
{
    return (a == (-1-0x7fff)) ? (0x7fff) : (int16_t) abs(a);
}
# 60 "awgn.c" 2
# 1 "spandsp/awgn.h" 1
# 72 "spandsp/awgn.h"
typedef struct awgn_state_s awgn_state_t;






__attribute__((visibility("default"))) awgn_state_t * awgn_init_dbm0(awgn_state_t *s, int idum, float level);

__attribute__((visibility("default"))) awgn_state_t * awgn_init_dbov(awgn_state_t *s, int idum, float level);

__attribute__((visibility("default"))) int awgn_release(awgn_state_t *s);

__attribute__((visibility("default"))) int awgn_free(awgn_state_t *s);

__attribute__((visibility("default"))) int16_t awgn(awgn_state_t *s);
# 61 "awgn.c" 2

# 1 "spandsp/private/awgn.h" 1
# 32 "spandsp/private/awgn.h"
struct awgn_state_s
{
    double rms;
    long int ix1;
    long int ix2;
    long int ix3;
    double r[98];
    double gset;
    int iset;
};
# 63 "awgn.c" 2
# 77 "awgn.c"
static double ran1(awgn_state_t *s)
{
    double temp;
    int j;

    s->ix1 = (7141*s->ix1 + 54773)%259200;
    s->ix2 = (8121*s->ix2 + 28411)%134456;
    s->ix3 = (4561*s->ix3 + 51349)%243000;
    j = 1 + ((97*s->ix3)/243000);
    if (j > 97 || j < 1)
    {

        return -1;
    }
    temp = s->r[j];
    s->r[j] = (s->ix1 + s->ix2*(1.0/134456))*(1.0/259200);
    return temp;
}


__attribute__((visibility("default"))) awgn_state_t * awgn_init_dbov(awgn_state_t *s, int idum, float level)
{
    int j;

    if (s == ((void*)0))
    {
        if ((s = (awgn_state_t *) malloc(sizeof(*s))) == ((void*)0))
            return ((void*)0);
    }
    if (idum < 0)
        idum = -idum;

    s->rms = ((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!((!!!((1?1:((10.0)))/2) || !!!((1?1:((level/20.0)))/2)) && ((!!((1?1:(((10.0))+((level/20.0))+1.0f))/2) && 2*sizeof(((10.0))+((level/20.0))+1.0f) == sizeof((((10.0))+((level/20.0))+1.0f)+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))+1.0f) == sizeof(float)))))0 : 0 ? (__typeof__(0 ? (double _Complex *)0 : (void *)!((!!!((1?1:((10.0)))/2) || !!!((1?1:((level/20.0)))/2)) && ((!!((1?1:(((10.0))+((level/20.0))))/2) && sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(float _Complex)))))0 : (__typeof__(0 ? (__typeof__(((10.0))+((level/20.0))) *)0 : (void *)((!!!((1?1:((10.0)))/2) || !!!((1?1:((level/20.0)))/2)) && (((!!((1?1:(((10.0))+((level/20.0))+1.0f))/2) && 2*sizeof(((10.0))+((level/20.0))+1.0f) == sizeof((((10.0))+((level/20.0))+1.0f)+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))+1.0f) == sizeof(float)) || ((!!((1?1:(((10.0))+((level/20.0))))/2) && sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(float _Complex))))))0 )))( ((!!((1?1:(((10.0))+((level/20.0))))/2) && sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(float _Complex)) && !!((1?1:((10.0)))/2) && !!((1?1:((level/20.0)))/2) ? cpowf((10.0), (level/20.0)) : ((!!((1?1:(((10.0))+((level/20.0))))/2) && sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(float _Complex)) ? cpow((10.0), (level/20.0)) : ((!!((1?1:(((10.0))+((level/20.0))))/2) && sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(double _Complex)) ? cpow((10.0), (level/20.0)) : ((!!((1?1:(((10.0))+((level/20.0))))/2) && sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? cpowl((10.0), (level/20.0)) : ((!!((1?1:((10.0)))/2) && 2*sizeof((10.0)) == sizeof(((10.0))+(__extension__ 1.0fi))) && sizeof((10.0)) == sizeof(float)) && ((!!((1?1:((level/20.0)))/2) && 2*sizeof((level/20.0)) == sizeof(((level/20.0))+(__extension__ 1.0fi))) && sizeof((level/20.0)) == sizeof(float)) ? powf((10.0), (level/20.0)) : ((!!((1?1:(((10.0))+((level/20.0))))/2) && 2*sizeof(((10.0))+((level/20.0))) == sizeof((((10.0))+((level/20.0)))+(__extension__ 1.0fi))) && sizeof(((10.0))+((level/20.0))) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? powl((10.0), (level/20.0)) : pow((10.0), (level/20.0)) ))*32768.0;

    s->ix1 = (54773 + idum)%259200;
    s->ix1 = (7141*s->ix1 + 54773)%259200;
    s->ix2 = s->ix1%134456;
    s->ix1 = (7141*s->ix1 + 54773)%259200;
    s->ix3 = s->ix1%243000;
    s->r[0] = 0.0;
    for (j = 1; j <= 97; j++)
    {
        s->ix1 = (7141*s->ix1 + 54773)%259200;
        s->ix2 = (8121*s->ix2 + 28411)%134456;
        s->r[j] = (s->ix1 + s->ix2*(1.0/134456))*(1.0/259200);
    }
    s->gset = 0.0;
    s->iset = 0;
    return s;
}


__attribute__((visibility("default"))) awgn_state_t * awgn_init_dbm0(awgn_state_t *s, int idum, float level)
{
    return awgn_init_dbov(s, idum, level - (3.14f + 3.02f));
}


__attribute__((visibility("default"))) int awgn_release(awgn_state_t *s)
{
    return 0;
}


__attribute__((visibility("default"))) int awgn_free(awgn_state_t *s)
{
    free(s);
    return 0;
}


__attribute__((visibility("default"))) int16_t awgn(awgn_state_t *s)
{
    double fac;
    double r;
    double v1;
    double v2;
    double amp;

    if (s->iset == 0)
    {
        do
        {
            v1 = 2.0*ran1(s) - 1.0;
            v2 = 2.0*ran1(s) - 1.0;
            r = v1*v1 + v2*v2;
        }
        while (r >= 1.0);
        fac = ((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2)))0 : (__typeof__(0 ? (__typeof__((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) *)0 : (void *)!!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2)))0 )))( ((!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r))+(__extension__ 1.0fi))) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(float _Complex)) ? csqrtf ((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) : ((!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r))+(__extension__ 1.0fi))) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(double _Complex)) ? csqrt ((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) : ((!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r))+(__extension__ 1.0fi))) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? csqrtl ((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) : ((!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2) && 2*sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r))+(__extension__ 1.0fi))) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(float)) ? sqrtf ((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) : ((!!((1?1:((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)))/2) && 2*sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r))+(__extension__ 1.0fi))) && sizeof((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? sqrtl ((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) : sqrt((-2.0*((__typeof__(*( 0 ? (__typeof__(0 ? (double *)0 : (void *)!!((1?1:((r)))/2)))0 : (__typeof__(0 ? (__typeof__((r)) *)0 : (void *)!!!((1?1:((r)))/2)))0 )))( ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float _Complex)) ? clogf ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(double _Complex)) ? clog ((r)) : ((!!((1?1:((r)))/2) && sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double _Complex) && sizeof(long double) != sizeof(double)) ? clogl ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(float)) ? logf ((r)) : ((!!((1?1:((r)))/2) && 2*sizeof((r)) == sizeof(((r))+(__extension__ 1.0fi))) && sizeof((r)) == sizeof(long double) && sizeof(long double) != sizeof(double)) ? logl ((r)) : log((r)) ))/r)) ));
        s->gset = v1*fac;
        s->iset = 1;
        amp = v2*fac*s->rms;
    }
    else
    {
        s->iset = 0;
        amp = s->gset*s->rms;
    }
    return fsaturate(amp);
}

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-14  9:49 spandsp build, lrint/sqrt/pow issue ojab
@ 2012-12-14 12:40 ` Szabolcs Nagy
  2012-12-14 12:59   ` ojab
  0 siblings, 1 reply; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-14 12:40 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

* ojab <ojab@ojab.ru> [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)

[-- Attachment #2: tg.diff --]
[-- Type: text/x-diff, Size: 1780 bytes --]

diff --git a/include/tgmath.h b/include/tgmath.h
index 5b65e21..832b052 100644
--- a/include/tgmath.h
+++ b/include/tgmath.h
@@ -59,10 +59,12 @@ sizeof(double) == sizeof(long double)
 
 /* function selection */
 
-#define __tg_real(fun, x) (__RETCAST(x)( \
+#define __tg_real_nocast(fun, x) ( \
 	__FLT(x) ? fun ## f (x) : \
 	__LDBL(x) ? fun ## l (x) : \
-	fun(x) ))
+	fun(x) )
+
+#define __tg_real(fun, x) (__RETCAST(x)__tg_real_nocast(fun, x))
 
 #define __tg_real_2_1(fun, x, y) (__RETCAST(x)( \
 	__FLT(x) ? fun ## f (x, y) : \
@@ -217,18 +219,18 @@ sizeof(double) == sizeof(long double)
 #define fmod(x,y)       __tg_real_2(fmod, (x), (y))
 #define frexp(x,y)      __tg_real_2_1(frexp, (x), (y))
 #define hypot(x,y)      __tg_real_2(hypot, (x), (y))
-#define ilogb(x)        __tg_real(ilogb, (x))
+#define ilogb(x)        __tg_real_nocast(ilogb, (x))
 #define ldexp(x,y)      __tg_real_2_1(ldexp, (x), (y))
 #define lgamma(x)       __tg_real(lgamma, (x))
-#define llrint(x)       __tg_real(llrint, (x))
-#define llround(x)      __tg_real(llround, (x))
+#define llrint(x)       __tg_real_nocast(llrint, (x))
+#define llround(x)      __tg_real_nocast(llround, (x))
 #define log(x)          __tg_real_complex(log, (x))
 #define log10(x)        __tg_real(log10, (x))
 #define log1p(x)        __tg_real(log1p, (x))
 #define log2(x)         __tg_real(log2, (x))
 #define logb(x)         __tg_real(logb, (x))
-#define lrint(x)        __tg_real(lrint, (x))
-#define lround(x)       __tg_real(lround, (x))
+#define lrint(x)        __tg_real_nocast(lrint, (x))
+#define lround(x)       __tg_real_nocast(lround, (x))
 #define nearbyint(x)    __tg_real(nearbyint, (x))
 #define nextafter(x,y)  __tg_real_2(nextafter, (x), (y))
 #define nexttoward(x,y) __tg_real_2(nexttoward, (x), (y))

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-14 12:40 ` Szabolcs Nagy
@ 2012-12-14 12:59   ` ojab
  2012-12-14 13:33     ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: ojab @ 2012-12-14 12:59 UTC (permalink / raw)
  To: musl

On 14.12.2012 16:40, Szabolcs Nagy wrote:
> * ojab <ojab@ojab.ru> [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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-14 12:59   ` ojab
@ 2012-12-14 13:33     ` Szabolcs Nagy
  2012-12-14 14:21       ` ojab
  0 siblings, 1 reply; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-14 13:33 UTC (permalink / raw)
  To: musl

* ojab <ojab@ojab.ru> [2012-12-14 16:59:57 +0400]:
> 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);
> 

both of these expressions work here (i386, gcc-4.4)

i think your compiler does not like the tgmath __RETCAST magic
and i have no idea what went wrong

> 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.

my point is that they shouldn't use it at all
(at least not in that particular translation unit, it's not wrong,
but pointless, it just makes compilation slow and fragile)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-14 13:33     ` Szabolcs Nagy
@ 2012-12-14 14:21       ` ojab
  2012-12-14 19:47         ` ojab
  0 siblings, 1 reply; 13+ messages in thread
From: ojab @ 2012-12-14 14:21 UTC (permalink / raw)
  To: musl

On 14.12.2012 17:33, Szabolcs Nagy wrote:
> * ojab <ojab@ojab.ru> [2012-12-14 16:59:57 +0400]:
>
> both of these expressions work here (i386, gcc-4.4)
>
> i think your compiler does not like the tgmath __RETCAST magic
> and i have no idea what went wrong

Looks like you're right and this is gcc-4.5.4 bug: gcc-4.2.4 on the same 
system builds spandsp without any issues.

//wbr ojab


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-14 14:21       ` ojab
@ 2012-12-14 19:47         ` ojab
  2012-12-15  0:47           ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: ojab @ 2012-12-14 19:47 UTC (permalink / raw)
  To: musl

On 14.12.2012 18:21, ojab wrote:
> On 14.12.2012 17:33, Szabolcs Nagy wrote:
>
> Looks like you're right and this is gcc-4.5.4 bug: gcc-4.2.4 on the same
> system builds spandsp without any issues.
>
> //wbr ojab

…and it is still broken with gcc (GCC) 4.8.0 20121209 (experimental)

awgn.c: In function 'awgn_init_dbov':
awgn.c:109:5: error: void value not ignored as it ought to be
      s->rms = pow(10.0, level/20.0)*32768.0;
      ^
awgn.c: In function 'awgn':
awgn.c:165:9: error: void value not ignored as it ought to be
          fac = sqrt(-2.0*log(r)/r);
          ^

Filled http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55695

//wbr ojab


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-14 19:47         ` ojab
@ 2012-12-15  0:47           ` Szabolcs Nagy
  2012-12-16 10:29             ` ojab
  0 siblings, 1 reply; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-15  0:47 UTC (permalink / raw)
  To: musl

* ojab <ojab@ojab.ru> [2012-12-14 23:47:28 +0400]:
> On 14.12.2012 18:21, ojab wrote:
> ?and it is still broken with gcc (GCC) 4.8.0 20121209 (experimental)
> 
> awgn.c:109:5: error: void value not ignored as it ought to be

interesting

> Filled http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55695

thanks


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-15  0:47           ` Szabolcs Nagy
@ 2012-12-16 10:29             ` ojab
  2012-12-16 14:12               ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: ojab @ 2012-12-16 10:29 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

On 15.12.2012 04:47, Szabolcs Nagy wrote:
> * ojab<ojab@ojab.ru>  [2012-12-14 23:47:28 +0400]:
>> >On 14.12.2012 18:21, ojab wrote:
>> >?and it is still broken with gcc (GCC) 4.8.0 20121209 (experimental)
>> >
>> >awgn.c:109:5: error: void value not ignored as it ought to be
> interesting
>
>> >Filledhttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=55695
> thanks
>

Just FYI: I've bisected gcc, first bad commit is 
http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a75b1c712f1eaddc69919461ead67f4ac21663fe
Looks like a bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31871 can 
be related.

Please note that clang also fails the testcase and the errors/warnings 
are aligned with gcc's (in the attached files).

//wbr ojab

[-- Attachment #2: clang.log --]
[-- Type: text/plain, Size: 2462 bytes --]

/tmp/retcast.c:38:7: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-pointer-cast]
  x = xpow(2,2);
      ^
/tmp/retcast.c:33:26: note: expanded from macro 'xpow'
#define xpow(x,y)        __tg_real_complex_pow((x), (y))
                         ^
/tmp/retcast.c:24:38: note: expanded from macro '__tg_real_complex_pow'
#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
                                     ^
/tmp/retcast.c:17:3: note: expanded from macro '__RETCAST_2'
                (void *)!((!__IS_FP(x) || !__IS_FP(y)) && __FLT((x)+(y)+1.0f))))0 : \
                ^
/tmp/retcast.c:38:7: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-pointer-cast]
  x = xpow(2,2);
      ^
/tmp/retcast.c:33:26: note: expanded from macro 'xpow'
#define xpow(x,y)        __tg_real_complex_pow((x), (y))
                         ^
/tmp/retcast.c:24:38: note: expanded from macro '__tg_real_complex_pow'
#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
                                     ^
/tmp/retcast.c:21:3: note: expanded from macro '__RETCAST_2'
                (void *)((!__IS_FP(x) || !__IS_FP(y)) && (__FLT((x)+(y)+1.0f) || __FLTCX((x)+(y))))))0 )))
                ^
/tmp/retcast.c:38:5: error: assigning to 'double' from incompatible type 'typeof (*(0 ? (typeof (0 ? (double *)0 : (void *)!((!!!((1 ? 1 : ((2))) / 2) || !!!((1 ? 1 : ((2))) / 2)) && ((!!((1 ? 1 : (((2)) + ((2)) + 1.F)) / 2) && 2 * sizeof (((2)) + ((2)) + 1.F) == sizeof ((((2)) + ((2)) + 1.F) + (__extension__ 1.Fi))) && sizeof (((2)) + ((2)) + 1.F) == sizeof(float)))))0 : 0 ? (typeof (0 ? (_Complex double *)0 : (void *)!((!!!((1 ? 1 : ((2))) / 2) || !!!((1 ? 1 : ((2))) / 2)) && ((!!((1 ? 1 : (((2)) + ((2)))) / 2) && sizeof (((2)) + ((2))) == sizeof ((((2)) + ((2))) + (__extension__ 1.Fi))) && sizeof (((2)) + ((2))) == sizeof(_Complex float)))))0 : (typeof (0 ? (typeof (((2)) + ((2))) *)0 : (void *)((!!!((1 ? 1 : ((2))) / 2) || !!!((1 ? 1 : ((2))) / 2)) && (((!!((1 ? 1 : (((2)) + ((2)) + 1.F)) / 2) && 2 * sizeof (((2)) + ((2)) + 1.F) == sizeof ((((2)) + ((2)) + 1.F) + (__extension__ 1.Fi))) && sizeof (((2)) + ((2)) + 1.F) == sizeof(float)) || ((!!((1 ? 1 : (((2)) + ((2)))) / 2) && sizeof (((2)) + ((2))) == sizeof ((((2)) + ((2))) + (__extension__ 1.Fi))) && sizeof (((2)) + ((2))) == sizeof(_Complex float))))))0))' (aka 'void')
  x = xpow(2,2);
    ^ ~~~~~~~~~
2 warnings and 1 error generated.

[-- Attachment #3: gcc.log --]
[-- Type: text/plain, Size: 1349 bytes --]

/tmp/retcast.c: In function ‘main’:
/tmp/retcast.c:17:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   (void *)!((!__IS_FP(x) || !__IS_FP(y)) && __FLT((x)+(y)+1.0f))))0 : \
   ^
/tmp/retcast.c:24:38: note: in expansion of macro ‘__RETCAST_2’
 #define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
                                      ^
/tmp/retcast.c:33:26: note: in expansion of macro ‘__tg_real_complex_pow’
 #define xpow(x,y)        __tg_real_complex_pow((x), (y))
                          ^
/tmp/retcast.c:38:7: note: in expansion of macro ‘xpow’
   x = xpow(2,2);
       ^
/tmp/retcast.c:21:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   (void *)((!__IS_FP(x) || !__IS_FP(y)) && (__FLT((x)+(y)+1.0f) || __FLTCX((x)+(y))))))0 )))
   ^
/tmp/retcast.c:24:38: note: in expansion of macro ‘__RETCAST_2’
 #define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
                                      ^
/tmp/retcast.c:33:26: note: in expansion of macro ‘__tg_real_complex_pow’
 #define xpow(x,y)        __tg_real_complex_pow((x), (y))
                          ^
/tmp/retcast.c:38:7: note: in expansion of macro ‘xpow’
   x = xpow(2,2);
       ^
/tmp/retcast.c:38:5: error: void value not ignored as it ought to be
   x = xpow(2,2);
     ^

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-16 10:29             ` ojab
@ 2012-12-16 14:12               ` Szabolcs Nagy
  2012-12-18  6:07                 ` ojab
  0 siblings, 1 reply; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-16 14:12 UTC (permalink / raw)
  To: musl

* ojab <ojab@ojab.ru> [2012-12-16 14:29:00 +0400]:
> Just FYI: I've bisected gcc, first bad commit is http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a75b1c712f1eaddc69919461ead67f4ac21663fe

thanks
i could not figure out what that commit did exactly

> Looks like a bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31871
> can be related.

this bug is different:
it is about that (void*)0 is not an integer constant expression
(which is sad: one cannot use pointer arithmetics in constant
expression context, so eg. offsetof cannot be implemented in c
eventhough the sizeof, alignment, padding information are all
available at compile-time)

> Please note that clang also fails the testcase and the
> errors/warnings are aligned with gcc's (in the attached files).
> 
> //wbr ojab

> /tmp/retcast.c:38:7: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-pointer-cast]
>   x = xpow(2,2);
>       ^
> /tmp/retcast.c:33:26: note: expanded from macro 'xpow'
> #define xpow(x,y)        __tg_real_complex_pow((x), (y))
>                          ^
> /tmp/retcast.c:24:38: note: expanded from macro '__tg_real_complex_pow'
> #define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
>                                      ^
> /tmp/retcast.c:17:3: note: expanded from macro '__RETCAST_2'
>                 (void *)!((!__IS_FP(x) || !__IS_FP(y)) && __FLT((x)+(y)+1.0f))))0 : \
>                 ^

yes, it is exploited here that the type of a ?: expression
is different when one of the operands is (void*)0 vs (void*)1

(since we want the macro to expand to an expression with the
proper type, which is not possible in c99 without compiler help,
hence typeof hacks, this also shows why tgmath.h is a bad idea)

it seems (void*)1 is not allowed in newer gcc and clang
eventhough it's allowed by the standard:

http://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p5

note that the ?: expression is not evaluated, only its type is used

(if the expression was evaluated the warning might made sense:
(void*)1 could be a trap representation)

i think it's a gcc and clang bug if

 __typeof__(0 ? (int*)0 : (void*)1)

is not a valid type expression, it should work just like

 sizeof(0 ? (int*)0 : (void*)1)

which is a valid expression in iso c
(typeof is not defined by any standard but it should not
evaluate its argument like sizeof)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-16 14:12               ` Szabolcs Nagy
@ 2012-12-18  6:07                 ` ojab
  2012-12-18 11:45                   ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: ojab @ 2012-12-18  6:07 UTC (permalink / raw)
  To: musl

On 16.12.2012 18:12, Szabolcs Nagy wrote:
> * ojab<ojab@ojab.ru>  [2012-12-16 14:29:00 +0400]:
>
> i think it's a gcc and clang bug if
>
>   __typeof__(0 ? (int*)0 : (void*)1)
>
> is not a valid type expression, it should work just like
>
>   sizeof(0 ? (int*)0 : (void*)1)
>
> which is a valid expression in iso c
> (typeof is not defined by any standard but it should not
> evaluate its argument like sizeof)
>

LLVM guys has closed http://llvm.org/bugs/show_bug.cgi?id=14618 as invalid.
Type expression, that mentioned above, compiles without errors on both 
gcc and clang, so looks like an error anywhere else. Testcase was:
int main() {
     __typeof__(0 ? (int*)0 : (void*)1) x;
}


//wbr ojab


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-18  6:07                 ` ojab
@ 2012-12-18 11:45                   ` Szabolcs Nagy
  2012-12-18 12:31                     ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-18 11:45 UTC (permalink / raw)
  To: musl

* ojab <ojab@ojab.ru> [2012-12-18 10:07:09 +0400]:
> LLVM guys has closed http://llvm.org/bugs/show_bug.cgi?id=14618 as invalid.
> Type expression, that mentioned above, compiles without errors on
> both gcc and clang, so looks like an error anywhere else. Testcase
> was:
> int main() {
>     __typeof__(0 ? (int*)0 : (void*)1) x;
> }

they should not close the bug if they don't understand it..

the bug has nothing to do with integer constant expressions

the more i look at it the more convinced i am that this
is a big fat clang bug

but you should cut down the test case to a smaller one,
i cannot do that without clang, the (void*)1 was just
my best guess

i assume the fp and float checks work in clang
so a smaller test case could be:

// should be the same as __typeof__(*(double*)0) x;
__typeof__(*(
0 ? (__typeof__(0 ? (double *)0 : (void *)0))0 :
0 ? (__typeof__(0 ? (double _Complex *)0 : (void *)1))0 :
    (__typeof__(0 ? (__typeof__(1) *)0 : (void *)1))0 )) x;

if this fails like the original one then you can cut down
even more by checking the individual branches:

// double* x
__typeof__(0 ? (double *)0 : (void *)1) x;

// double _Complex* y
__typeof__(0 ? (double _Complex *)0 : (void *)1) y;

// void* z
__typeof__(0 ? (__typeof__(1) *)0 : (void *)1) z;

etc.

if the above works then the error is in the
__IS_FP or FLT or FLTCX macros


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-18 11:45                   ` Szabolcs Nagy
@ 2012-12-18 12:31                     ` Szabolcs Nagy
  2012-12-18 13:50                       ` Szabolcs Nagy
  0 siblings, 1 reply; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-18 12:31 UTC (permalink / raw)
  To: musl

* Szabolcs Nagy <nsz@port70.net> [2012-12-18 12:45:09 +0100]:
> * ojab <ojab@ojab.ru> [2012-12-18 10:07:09 +0400]:
> > LLVM guys has closed http://llvm.org/bugs/show_bug.cgi?id=14618 as invalid.
> > Type expression, that mentioned above, compiles without errors on
> > both gcc and clang, so looks like an error anywhere else. Testcase
> > was:
> > int main() {
> >     __typeof__(0 ? (int*)0 : (void*)1) x;
> > }
> 
> they should not close the bug if they don't understand it..
> 
> the bug has nothing to do with integer constant expressions
> 
> the more i look at it the more convinced i am that this
> is a big fat clang bug
> 

i take this back

i found an old clang-2.7 around and i could
reproduce the error with it so the problem is

__typeof__(*(0 ? (double*)0 : 0 ? (void*)0 : (void*)0)) x;

we expect this to be double, but clang evaluates
it as void

which means clang does not treat 0?(void*)0:(void*)0
as a null pointer constant

which is most likely correct so then this is a gcc bug

i'd let them both know about the issue meanwhile
i'll try to think about a workaround..

(i'd also argue that this is a bug in the standard
but then the definition of integer constant expression
should be changed as well, now it seems to be that
0?(void*)0:(void*)0 is not even a 'constant expressoin'
which means it cannot be used in initializers, which
is absurd)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: spandsp build, lrint/sqrt/pow issue
  2012-12-18 12:31                     ` Szabolcs Nagy
@ 2012-12-18 13:50                       ` Szabolcs Nagy
  0 siblings, 0 replies; 13+ messages in thread
From: Szabolcs Nagy @ 2012-12-18 13:50 UTC (permalink / raw)
  To: musl

* Szabolcs Nagy <nsz@port70.net> [2012-12-18 13:31:49 +0100]:
> (i'd also argue that this is a bug in the standard
> but then the definition of integer constant expression
> should be changed as well, now it seems to be that

i did not write a formal defect report to the iso c
committee, but at least i posted an article about
the issue on comp.std.c

http://groups.google.com/group/comp.std.c/browse_thread/thread/d7f0a53ea77ad57e


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-12-18 13:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14  9:49 spandsp build, lrint/sqrt/pow issue ojab
2012-12-14 12:40 ` Szabolcs Nagy
2012-12-14 12:59   ` ojab
2012-12-14 13:33     ` Szabolcs Nagy
2012-12-14 14:21       ` ojab
2012-12-14 19:47         ` ojab
2012-12-15  0:47           ` Szabolcs Nagy
2012-12-16 10:29             ` ojab
2012-12-16 14:12               ` Szabolcs Nagy
2012-12-18  6:07                 ` ojab
2012-12-18 11:45                   ` Szabolcs Nagy
2012-12-18 12:31                     ` Szabolcs Nagy
2012-12-18 13:50                       ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).