mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gabriel Ravier <>
To:, Joakim Sindholt <>
Subject: Re: [musl] ecvt(0, 0, ...) is broken
Date: Tue, 6 Sep 2022 14:21:52 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 9/6/22 14:13, Joakim Sindholt wrote:
> On Tue, 6 Sep 2022 12:12:48 +0200, Gabriel Ravier <> wrote:
>> Executing ecvt(0, 0, &decpt, &sign) results in musl returning
>> "000000000000000".
>> This seems highly likely to be a bug considering that glibc returns ""
>> and I see no plausible reasoning for musl's behavior that could be
>> justified by the standard.
> POSIX.1-2001 said:
>> The ecvt() function shall convert value to a null-terminated string of
>> ndigit digits (where ndigit is reduced to an unspecified limit
>> determined by the precision of a double) and return a pointer to the
>> string. The high-order digit shall be non-zero, unless the value is 0.
> The first part would imply that ndigit=0 should return the string "" but
> the second part makes no provision for a zero-digit-long string.
> I would say ndigit=0 is UB.
Wouldn't that then mean that any request call of fcvt with a small 
ndigits but very small value that isn't 0, as in my previous email, 
would also be UB (since if my logic is correct, the string cannot start 
with a 0 but it also cannot start with any other value, which forces it 
to be empty) ? That seems rather excessive...

  reply	other threads:[~2022-09-06 12:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  9:27 [musl] Bug report: fcvt seems dysfunctional Gabriel Ravier
2022-09-06 10:12 ` [musl] ecvt(0, 0, ...) is broken Gabriel Ravier
2022-09-06 12:13   ` Joakim Sindholt
2022-09-06 12:21     ` Gabriel Ravier [this message]
2022-09-06 14:17       ` Rich Felker
2022-09-06 18:48         ` Markus Wichmann
2022-09-06 19:19           ` Rich Felker
2022-09-07  3:39             ` Markus Wichmann
2022-09-07  3:51               ` Jeffrey Walton
2022-09-07 13:44                 ` Rich Felker

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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

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).