From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by sourceware.org (Postfix) with ESMTPS id E7CE63858C27 for ; Wed, 17 Nov 2021 12:27:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E7CE63858C27 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MfZDK-1mBmMu2mj2-00g4Hw for ; Wed, 17 Nov 2021 13:27:56 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id AD162A80D4F; Wed, 17 Nov 2021 13:27:55 +0100 (CET) Date: Wed, 17 Nov 2021 13:27:55 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: possible snprintf() regression in 3.3.2 Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20211117003718.GF10332@venus.tony.develop-help.com> <20211117182108.b38599f5e13071bf269a0d48@nifty.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211117182108.b38599f5e13071bf269a0d48@nifty.ne.jp> X-Provags-ID: V03:K1:f1Fh6+quE5CGAOQadB6GtBsPWWfBf6eHo812hazn9iFt1GNBuYa +vW8YsZ9rvKKX8RXxMjrJ+aHgroclkw9FhVeZAhsOOPfrS/ype+7nOlD/IL1fCPjrlOlzhD bdiWza22XsXIq/clHHtQovuXXdzsvky3tCHvhnzvHfAhvA5B556vNgQieAh0okJudGcZPL9 mHrE7pBQFB4Zio1IIb9Nw== X-UI-Out-Filterresults: notjunk:1;V03:K0:2q+Qqa2hx7M=:16Vn1DKa74+nGMQiNbKYd1 GfN7ilC/BDDyGtSbmTbV0SMNMwgWeuG9EsYKboU8kVyErgsqGo1l4TJjmzVMiHyjoWFJO404C WdbVP/BRr4bTtolxJ03DRN+jttyYDA2nUeFFXlu17cQVvl/fMskP5LAtTqo8kZ+HVWG5iWtVa 2RW2rP8C7jK7pB19wp4xcjO1ghnW4Fz/UW1RGOdsSnLF6ezaUawP9/LYIPzpCDj+3IAbxBbgo 7rE3BeCbMmFwRhakKnCVI59sebqn5PNmRM4bmipQPf7VDVNW3zS2lxdH041EXpbC8dzFRzgYS QBq8A8rIIEyObZX3kc+ZS2Af05aAGVfzm7ZgEIxNQCZJfqV2498KDDc8F8IKwDKAN0rCCmcSj 1SknTkYVojzjbu078NVL+6qQ3gmhFn1kr8SNGPZDN1/sV7r9C4NbaTEotUgsILFKBGwhbz3Vl 2w3Tatzlgfhu5Kr0ldg1YchQ/yoKWsJbnbG3olVHbay6pTn8CigBdpz9deerUDZHTZtjgElLf e8Zi/BnA0rN7DkxmYMwiQJcrrC7sFeQAESzcjd6xluWm1PuxwUuMKBnMf8d/B5cBMRGyc+DHq LUmVT64580KIQs8i1s0XIhBIPdGChlFEf6UROYgURyniFUnhXzO/NQ9ChXIndqcX2cBJ5gYSo jNnKodwyiHzoHIHrJ5ifUChxhRxuOt3hUwYeMadGV7mukqiNuIe1SD6av+yBHD+PaU4wqY9Bq J+0ED1ayWUuygU+U X-Spam-Status: No, score=-99.1 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2021 12:28:00 -0000 On Nov 17 18:21, Takashi Yano via Cygwin wrote: > On Wed, 17 Nov 2021 11:37:18 +1100 > Tony Cook wrote: > > This came up from regression testing perl. > > > > Regression testing of perl @4a1b9dd524007193213d3919d6a331109608b90c > > used (from uname): > > [...] > I found the caused by the commit: > commit 4d90e5335914551862831de3e02f6c102b78435b > Author: Corinna Vinschen > Date: Thu Nov 4 11:30:44 2021 +0100 > > ldtoa: fix dropping too many digits from output > > ldtoa cuts the number of digits it returns based on a computation of > number of supported bits (144) divide by log10(2). Not only is the > integer approximation of log10(2) ~= 8/27 missing a digit here, it > also fails to take really small double and long double values into > account. > > Allow for the full potential precision of long double values. At the > same time, change the local string array allocation to request only as > much bytes as necessary to support the caller-requested number of > digits, to keep the stack size low on small targets. > > In the long run a better fix would be to switch to gdtoa, as the BSD > variants, as well as Mingw64 do. > > Signed-off-by: Corinna Vinschen > > Reverting this commit solves the problem. > > Corinna, could you please have a look? I don't have a good solution. The old ldtoa code is lacking, for switching newlib to gdtoa I simply don't have the time. On the newlib list was a short discussion starting at https://sourceware.org/pipermail/newlib/2021/018626.html but nothing came out of it yet. Patches gratefully accepted (except just reverting the above change). Corinna