From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/921 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: A little more progress today with clang/LLVM Date: Sat, 26 May 2012 14:49:41 +0200 Message-ID: <20120526124940.GI17860@port70.net> References: <6099278.PLLg0Rc9Yf@main.pennware.com> <20120525230938.GZ163@brightrain.aerifal.cx> <20292255.R6gnMuUDLb@main.pennware.com> <11654110.pFvND7RYFl@main.pennware.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1338036600 8867 80.91.229.3 (26 May 2012 12:50:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 May 2012 12:50:00 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-922-gllmg-musl=m.gmane.org@lists.openwall.com Sat May 26 14:49:59 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SYGRN-00026Y-77 for gllmg-musl@plane.gmane.org; Sat, 26 May 2012 14:49:53 +0200 Original-Received: (qmail 1484 invoked by uid 550); 26 May 2012 12:49:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 1475 invoked from network); 26 May 2012 12:49:53 -0000 Content-Disposition: inline In-Reply-To: <11654110.pFvND7RYFl@main.pennware.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:921 Archived-At: * Richard Pennington [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)