From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F08033858D3C for ; Sun, 1 May 2022 19:09:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F08033858D3C Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-ACs3VVwaMbaqipK1aCJeRQ-1; Sun, 01 May 2022 15:09:17 -0400 X-MC-Unique: ACs3VVwaMbaqipK1aCJeRQ-1 Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-2f83cc145edso119543707b3.11 for ; Sun, 01 May 2022 12:09:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6F94rvXOvCtIxa5/04tyhWnlgMXBdRRoIdU5taIRl4w=; b=PQp3hgLg6LDZzrU44zFJ4txSwQX0LO8jPtmwGuso2hvXWJyr2g2G14eI1yzVZMmwC8 9lLoGWgLBegxfytr+RO5dgdaYAzoiagPX5dfGPjMgDMMQSI4CXFtnI1HcRFJokM6ll4y vMTVwkuy4ssSVoIIS9qMCpvu2Yola1m+sWLEv60xHFwHT7uq8QYjwGtHSTttoCtQfOg3 ABVEVS2Z58ZKQsHcam2O+/3+bQY8mitLyTCOQxEDo6b/sT1zdTrUuH5QlcVhPJKFd24c Sp+PZoFacAJvUU4ZNBTV4Yb3FwOHDoIV+bmwu7XPAWcT0NB01RW9/1sia30WWG+ubZE7 X2zA== X-Gm-Message-State: AOAM530CwElKIOHFoxDlnEB/d2D5eHoXrpMrezVgezIfNBuilayuzmEH 3nz0HhZTOZX3KCpZhMxxm3HY65k7u+4YaAnoCbNIMzDLnoFcgEC7iCC8wIKIikafX25Z2VUk4Z5 WRKbk2tUD1xlWDp1wKAcT5dVdrHUkgdo= X-Received: by 2002:a81:5517:0:b0:2f8:c0b4:fc19 with SMTP id j23-20020a815517000000b002f8c0b4fc19mr8475078ywb.473.1651432157104; Sun, 01 May 2022 12:09:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGVSgZefrRWIs0Kgi+IJB8x/YeKx6//iwXBpb6gwUksynbSlAPWCutZJdpP5ujnO4eILD8xlnH6IwlBM2R8fg= X-Received: by 2002:a81:5517:0:b0:2f8:c0b4:fc19 with SMTP id j23-20020a815517000000b002f8c0b4fc19mr8475069ywb.473.1651432156893; Sun, 01 May 2022 12:09:16 -0700 (PDT) MIME-Version: 1.0 References: <20220501182109.3668200-1-ppalka@redhat.com> In-Reply-To: <20220501182109.3668200-1-ppalka@redhat.com> From: Jonathan Wakely Date: Sun, 1 May 2022 20:09:05 +0100 Message-ID: Subject: Re: [PATCH 1/2] libstdc++: case-sensitivity in hexfloat std::from_chars [PR105441] To: Patrick Palka Cc: gcc Patches , "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2022 19:09:19 -0000 On Sun, 1 May 2022 at 19:22, Patrick Palka via Libstdc++ wrote: > > The hexfloat parser for binary32/64 added in r12-6645-gcc3bf3404e4b1c > overlooked that the exponent part can also begin with an uppercase 'P'. > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk/11, and possibly the > 12 branch now for 12.1? OK for trunk, and as it's a regression since gcc-11 I'd recommend release manager approval for 12.1 as well, but it's the RMs call. > > PR libstdc++/105441 > > libstdc++-v3/ChangeLog: > > * src/c++17/floating_from_chars.cc (__floating_from_chars_hex): > Also accept 'P' as the start of the exponent. > * testsuite/20_util/from_chars/7.cc: Add corresponding testcase. > --- > libstdc++-v3/src/c++17/floating_from_chars.cc | 2 +- > libstdc++-v3/testsuite/20_util/from_chars/7.cc | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc > index 13de1e346ab..e7f3a58cf18 100644 > --- a/libstdc++-v3/src/c++17/floating_from_chars.cc > +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc > @@ -664,7 +664,7 @@ namespace > > // Parse the written exponent. > int written_exponent = 0; > - if (first != last && *first == 'p') > + if (first != last && (*first == 'p' || *first == 'P')) > { > // Tentatively consume the 'p' and try to parse a decimal number. > const char* const fallback_first = first; > diff --git a/libstdc++-v3/testsuite/20_util/from_chars/7.cc b/libstdc++-v3/testsuite/20_util/from_chars/7.cc > index 2a78c7441e2..1aa9b230531 100644 > --- a/libstdc++-v3/testsuite/20_util/from_chars/7.cc > +++ b/libstdc++-v3/testsuite/20_util/from_chars/7.cc > @@ -96,6 +96,7 @@ constexpr testcase testcases[] = { > { "1p-1", 4, {}, 0x1p-1 }, > { "0", 1, {}, 0.0 }, > { "A", 1, {}, 0xA }, > + { "1.ABCDEFP+10", 12, {}, 0x1.ABCDEFP+10 }, > { "-1", 2, {}, -1.0 }, > { "-0", 2, {}, -0.0 }, > { "42", 2, {}, 0x42p0 }, > -- > 2.36.0.44.g0f828332d5 >