From patchwork Mon Aug 19 21:35:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 96109 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FE67384A466 for ; Mon, 19 Aug 2024 21:35:53 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 63D8E384A449 for ; Mon, 19 Aug 2024 21:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63D8E384A449 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 63D8E384A449 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724103324; cv=none; b=cTg99yui6V2hTBzQ5RN8pjDxS5WBpiNVR/VquzEn2J/odt9oWxXYomJuUEkoAid4ZblAgk2M9z2MT78lt0z+cJbUtHspdbvVwLnqrJKTV2UJwuQKmfES/9hflZC7stiYo7d3r98xTM8LMFNp/8jY7xUv/fG9paay91YbNd91zhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724103324; c=relaxed/simple; bh=a3mJdWxbEC++SbZA4bu3noMcAaF8q1qWzCFzSUe0Ah0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=qLlIJ+Za5Ivb3RCQOXhAWMk7WJklIeKnlkzsmtwvE+FXuziRtkllhUOP+4d7Jw/BWPCWA/8Z7fJvzw2dbyB1pWfRj/GnKObyFRy/nTEjZmoX5R8+3fzBr+GrQJwKbIwoo6UqBa0RKke2FUTd9SAtyCtX07qCKdnOi1TiUSSBkEc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724103323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=EAU+f7WspNnDvM3/odIGjFg7LFZKMZnB7hXqwYDRRig=; b=HsEVYOHiaJOZbbgKJ5xRs0+XlxX52OWghPzE8vMpUDlszPao9JS/dDqr5nXdeP0/G6F5c/ eqLrxA+7eGf0rIJIrxt4mnaVaXl0BAy+v9mrJ/F9LLGcvuCG2FEiWhpAG5ecNjf4Gf0Rm8 ih75NBC3jq623OruYvhpEpIGgYf33zs= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-EIFBmbp4MMeVUWAA2jI6eQ-1; Mon, 19 Aug 2024 17:35:21 -0400 X-MC-Unique: EIFBmbp4MMeVUWAA2jI6eQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42808efc688so40076595e9.0 for ; Mon, 19 Aug 2024 14:35:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724103320; x=1724708120; h=mime-version:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=EAU+f7WspNnDvM3/odIGjFg7LFZKMZnB7hXqwYDRRig=; b=rehupo7nXIMHeiwQoA+PL5IEFtsasP3qZrOJhJHPy475XDnaOn21QrAtyGT3vPSbPS nXPTOkdL9phqZlCdJVuAhSu4VZEE8zuwcYcYxR0AzRKvnhC80k6PUsCo4hv6s7n4Cque LRJHQmwtnJX2fytaD5IaZ9mw2wjZABtN2J/nZxJDaJlemjfWXUmUM52OkA9jn7Wou/Kt Xt5DlZHMq2cENHQe9cZhkOUjxUfjbDWQuCynsgh9dhymrxKF78ly3UFcrFLIFKfT0acl V5yl5Wd7/OscNLhAD9vMhGk3hL9iYZLLCImlS4sEd+AzaqUBXd8OlQH1gvY2u1kF4PpE iV7w== X-Gm-Message-State: AOJu0YyHeaAitm2cK27uIqFi5/X3Ss7NncsQqMvK3UgJATkUTsAkFanf /QG5xQ34w3x6c2kuLEaVAc1s67JzBYFhnd25qaNiqHhtbVyuwteayQwryzYHNBTE31WKwZoI2y0 KXNyNJM9kAJ1pkaEG2t7EnlkB+ZrYwuGmNqnvJgqXifzhMenNRE0h2XrHRZXWZyDoKqU6sJKhet bSdJRVSA3u4dUAMPT8OoXSI59y2Ajnc6r0KFcpkpgWpg== X-Received: by 2002:a05:600c:3c92:b0:428:14b6:ce32 with SMTP id 5b1f17b1804b1-429ed794e9bmr92059255e9.9.1724103320491; Mon, 19 Aug 2024 14:35:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcBsbQWlaVpNhRQIhpEQ0v9QfmHDSWoGIldQcSxm+29u+ZJhzBuhqLGftm3KqAwgRK9Gw4PA== X-Received: by 2002:a05:600c:3c92:b0:428:14b6:ce32 with SMTP id 5b1f17b1804b1-429ed794e9bmr92059065e9.9.1724103319751; Mon, 19 Aug 2024 14:35:19 -0700 (PDT) Received: from digraph.polyomino.org.uk (digraph.polyomino.org.uk. [2001:8b0:bf73:93f7::51bb:e332]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed6593casm120529175e9.28.2024.08.19.14.35.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 14:35:19 -0700 (PDT) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1sgA22-00FKpc-1c for libc-alpha@sourceware.org; Mon, 19 Aug 2024 21:35:18 +0000 Date: Mon, 19 Aug 2024 21:35:18 +0000 (UTC) From: Joseph Myers To: libc-alpha@sourceware.org Subject: Add tests of more strtod special cases Message-ID: <445d863a-ce-d69e-4334-86efbd1b38cf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.1 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_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org There is very little test coverage of inputs to strtod-family functions that don't contain anything that can be parsed as a number (one test of ".y" in tst-strtod2), and none that I can see of skipping initial whitespace. Add some tests of these things to tst-strtod2. Tested for x86_64. --- This test is relative to a tree with and (pending review) applied. diff --git a/stdlib/tst-strtod2.c b/stdlib/tst-strtod2.c index c84bd792c1..d00bc13323 100644 --- a/stdlib/tst-strtod2.c +++ b/stdlib/tst-strtod2.c @@ -31,6 +31,20 @@ struct test_strto ## FSUF \ { "0x1px", 1.0 ## LSUF, 3 }, \ { "0x1p+x", 1.0 ## LSUF, 3 }, \ { "0x1p-x", 1.0 ## LSUF, 3 }, \ + { "", 0.0 ## LSUF, 0 }, \ + { ".", 0.0 ## LSUF, 0 }, \ + { "-", 0.0 ## LSUF, 0 }, \ + { "-.", 0.0 ## LSUF, 0 }, \ + { ".e", 0.0 ## LSUF, 0 }, \ + { "-.e", 0.0 ## LSUF, 0 }, \ + { " \t", 0.0 ## LSUF, 0 }, \ + { " \t.", 0.0 ## LSUF, 0 }, \ + { " \t-", 0.0 ## LSUF, 0 }, \ + { " \t-.", 0.0 ## LSUF, 0 }, \ + { " \t.e", 0.0 ## LSUF, 0 }, \ + { " \t-.e", 0.0 ## LSUF, 0 }, \ + { " \t\f\r\n\v1", 1.0 ## LSUF, 7 }, \ + { " \t\f\r\n\v-1.5e2", -150.0 ## LSUF, 12 }, \ { "INFx", INFINITY, 3 }, \ { "infx", INFINITY, 3 }, \ { "INFINITx", INFINITY, 3 }, \