From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4795 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: printf issues Date: Fri, 4 Apr 2014 23:10:23 +0200 Message-ID: <20140404211023.GJ3034@port70.net> References: <20140404141515.GD3034@port70.net> <20140404150705.GN26358@brightrain.aerifal.cx> <20140404185413.GH3034@port70.net> <20140404210011.GQ26358@brightrain.aerifal.cx> 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: ger.gmane.org 1396645845 22150 80.91.229.3 (4 Apr 2014 21:10:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2014 21:10:45 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4799-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 04 23:10:38 2014 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 1WWBNj-0003NU-R1 for gllmg-musl@plane.gmane.org; Fri, 04 Apr 2014 23:10:35 +0200 Original-Received: (qmail 3868 invoked by uid 550); 4 Apr 2014 21:10:35 -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 3860 invoked from network); 4 Apr 2014 21:10:35 -0000 Content-Disposition: inline In-Reply-To: <20140404210011.GQ26358@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4795 Archived-At: * Rich Felker [2014-04-04 17:00:11 -0400]: > On Fri, Apr 04, 2014 at 08:54:13PM +0200, Szabolcs Nagy wrote: > > > #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 > > > long double modfl(long double x, long double *iptr) > > > { > > > return modf(x, (double *)iptr); > > > } > > > > yes, this is an aliasing violation, nice catch > > > > the original idea was to allow tail call opt for these wrappers, > > so they are a single branch instruction, we should fix it but > > i think we can rely on that the ptr representations are the same: > > > > long double modfl(long double x, long double *iptr) > > { > > union {long double *ld; double *d;} u = {iptr}; > > return modf(x, u.d); > > } > > No, that doesn't change anything. The problem is that the object being > accessed is aliased with another type, which is illegal. The pointer > type/cast are not a problem, so this "workaround" is working around > the naive outward view of the issue ("bad pointer cast") and not the > actual issue (aliasing). ah yes, my bad but with temporaries gcc-4.8 does not figure out the tco.. and i don't see other ways around (other than cheating and adding the single jmp solution to all arch in asm) i think only modfl and sincosl are affected so uselessly shuffling things around the stack is probably not too expensive