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 ED8203858D33 for ; Sun, 1 May 2022 18:21:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED8203858D33 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-7ZQRCy44MlaqKqUGa2o92A-1; Sun, 01 May 2022 14:21:13 -0400 X-MC-Unique: 7ZQRCy44MlaqKqUGa2o92A-1 Received: by mail-qk1-f200.google.com with SMTP id y140-20020a376492000000b0069f7e985c95so8823406qkb.15 for ; Sun, 01 May 2022 11:21:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZrF0uOkSnnm/GPFcjChIkG38H1p60zppuFmV11pwm3A=; b=s37CfQkeQQVmQ8U6XozKVv8IuvpB53j5lEoVyHvzqdV2Z6DlRz4jVyhsSOrsZJzwRR 2zNxlS0MBGut8u/6ya1vR29RXnjNYW9K3w/hfsK3VWJ013tFNPHIjFGp/AV390CB6UGX DtJvMW+ySZVqa6i5UXBFAKy1ClzEaTk0SwSQDUShR5fzQ1oYToEiEfl5uSKfmh3FNstl 7ygc7539zYs+5Ek0DlG6ZOo8nHUDnfbMfDiTQYgZVMThIRphDD9DqstLtg9JCThRTGoy iMkvdom80EgTlrRT2QPmGanG+mARo1I3erAD6HQtGV/TxsGAUwTldm1K5/t6JOqMruib nRfQ== X-Gm-Message-State: AOAM5336INNQ+3WJpdzDiAm5HwvFSwFD1hae3pNXY2UTpdkrAu5D3Hfw Kitrfr35CrWiit+TAwbW/uHdqupCj0nwvXTh1/PiyR6ISdKnDvd/txncpuhi+WK9PQ4QBsz4519 zDnotl2T8iGV8O/Q= X-Received: by 2002:a05:622a:91:b0:2f3:88b3:6ee9 with SMTP id o17-20020a05622a009100b002f388b36ee9mr7709622qtw.383.1651429273024; Sun, 01 May 2022 11:21:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpull7opbd04Id+P8vrzC0Z3vkvQGkUWUBCbLCPv4O2rddVsGoDlfZVmgKKdIOq9zoT6bLSg== X-Received: by 2002:a05:622a:91:b0:2f3:88b3:6ee9 with SMTP id o17-20020a05622a009100b002f388b36ee9mr7709613qtw.383.1651429272814; Sun, 01 May 2022 11:21:12 -0700 (PDT) Received: from localhost.localdomain (ool-18e40894.dyn.optonline.net. [24.228.8.148]) by smtp.gmail.com with ESMTPSA id i11-20020ac84f4b000000b002f39b99f672sm2932817qtw.12.2022.05.01.11.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 May 2022 11:21:12 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH 1/2] libstdc++: case-sensitivity in hexfloat std::from_chars [PR105441] Date: Sun, 1 May 2022 14:21:08 -0400 Message-Id: <20220501182109.3668200-1-ppalka@redhat.com> X-Mailer: git-send-email 2.36.0.44.g0f828332d5 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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=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: 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 18:21:17 -0000 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? 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