| 
  | 
Message-ID: <20120526124940.GI17860@port70.net>
Date: Sat, 26 May 2012 14:49:41 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: A little more progress today with clang/LLVM
* Richard Pennington <rich@...nware.com> [2012-05-26 06:39:25 -0500]:
> My tgmath.h test cases fail, for example (f is a float, d is a double):
> 
tgmath.h is non-trivial and is not extensively tested so there can be issues
> ../../../../../src/libs/math/001tgmath.c:15:7: error: assigning to 'float' from 
> incompatible type 'typeof (*(0
>       ? (typeof (0 ? (double *)0 : (void *)!!((1 ? 1 : ((f))) / 2)))0 : 
> (typeof (0 ? (typeof ((f)) *)0 :
>       (void *)!!!((1 ? 1 : ((f))) / 2)))0))' (aka 'void')
sounds like a clang bug
this code is marked with #ifdef __GNUC__ and
uses __typeof__ and ?: trics to be able to cast
the return value to the correct type
to try the messy expression above in isolation you can use:
#define T __typeof__
#define ISFP(x) !!((1?1:(x))/2)
float f = 0.1;
T(*(0 ? (T(0 ? (double *)0 : (void *)ISFP(f)))0 :
        (T(0 ? (T(f) *)0 : (void *)!ISFP(f)))0)) *x = &f;
but i think clang gets the ?: thing wrong
eg. try
__typeof__(0 ? (char*)0 : (void*)1) p;
void **pp = &p;
__typeof__(0 ? (char*)0 : (void*)0) q;
char **qq = &q;
(this should compile cleanly)
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.