From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: musl 0.8.9 released
Date: Sun, 22 Apr 2012 14:05:03 -0400 [thread overview]
Message-ID: <20120422180503.GI14673@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAOH62JhgiA4j3NdBJY+QBb8Db4CLuVOmOUh5Y=LHGXnbghUKoQ@mail.gmail.com>
On Sun, Apr 22, 2012 at 02:19:53PM +0200, Pascal Cuoq wrote:
> On Fri, Apr 20, 2012 at 4:06 AM, Rich Felker <dalias@aerifal.cx> wrote:
> > Bug-fix release for a serious breakage in strtol and related
> > functions that made it into the previous release and prevents them
> > from handling numbers with initial spaces.
>
> Sorry for arriving after the battle, and it is nowhere near as serious, but:
>
> src/internal/floatscan.c, line 136:
>
> /* Align incomplete final B1B digit */
> if (k<KMAX && j) {
>
> The condition k<KMAX always holds. The earlier for-loop can be exited
> with at most k == KMAX-2.
> You probably meant:
>
> if (k < KMAX-2 && j).
>
> If you took a bit of safety margin in your choice of KMAX limits, it
> seems to me that it may never matter. But if this is the case, why
> bother testing k at all?
Indeed. There's plenty of extra space in the array because it has to
be rounded up to power-of-two size to avoid expensive mod operations.
Actually, since we only ever inc/dec, I wonder if I should just
replace the masking with a conditional add/sub of KMAX after the
inc/dec; then I could eliminate all the wasted stack space by using a
much smaller value (roughly LDBL_EXP_MAX/12).
In any case, the code does need to ensure that incrementing z does not
overflow in the decimal-point-alignment code that follows, so for now
I'll just make some changes that remove the redundant check and ensure
(perhaps overly careful) that we don't wrap..
Rich
prev parent reply other threads:[~2012-04-22 18:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 2:06 Rich Felker
2012-04-22 12:19 ` Pascal Cuoq
2012-04-22 18:05 ` Rich Felker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120422180503.GI14673@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).