Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 4 Apr 2014 23:10:23 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: printf issues

* Rich Felker <dalias@...ifal.cx> [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

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.