From patchwork Tue Aug 13 17:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1972049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Cf4u29kf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WjzXN72dlz1yZl for ; Wed, 14 Aug 2024 03:53:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BEA23858417 for ; Tue, 13 Aug 2024 17:53:55 +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 081C33858C50 for ; Tue, 13 Aug 2024 17:53:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 081C33858C50 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 081C33858C50 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=1723571621; cv=none; b=m6kQhjmw0i/PxVRLXMj+Jrj8jS13mZhLmRgyMl9uUhwfVWE+tmL/0HYZHLzXsXbGKNMiESTzKzTfPHLgCOcmgEokGEV0SjFk57iV8L4ISGyKzQhvfxMuGbMlNCHfO2UPvbIY1XT7+7fxlUx04LjofIeStEDUOEUw25Om5xgXAQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723571621; c=relaxed/simple; bh=BJMYIaSnWYqYlELBQ6A0hIrjyV+DOtxk0QpNJXFT6og=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=p2gRpTWluhax4lMjfrp2Gej5bTxBK0gqaAi55g4AXY7dD9y0CEv86lCdkCImIrSsrTrVfh2YcY+9fjVpShLRbprnx/qaFg9l1auGcxxmZqTRUqc+/zUxMuaOHTOIOmoZ5n47lbU28J+ivhzkOkedF9tvI9fWy/mPOgYtVY2DqUA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723571619; 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=RW75bErq+J4Wu1Pi7i79uWx3+RWDAk1kUc1WgXIV3b4=; b=Cf4u29kfu+rvxVp6e1MxPgEiLI15OPTchmw7RpnkreyLjbnUNPxak5c/eGq3zkzy2fMJAd ibeUTNYEY2rEBwG3/o3mODQgePgJgnXPNFA1uXnRAneaAFrqOnc4rPpQiPVZrGB441TLGw H6Q8/cppGMNAWxli7WuK1myH0M5BT04= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-QZSQWgaPMU-evxffrJBNKw-1; Tue, 13 Aug 2024 13:53:37 -0400 X-MC-Unique: QZSQWgaPMU-evxffrJBNKw-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42820c29a76so46231285e9.2 for ; Tue, 13 Aug 2024 10:53:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723571615; x=1724176415; h=mime-version:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RW75bErq+J4Wu1Pi7i79uWx3+RWDAk1kUc1WgXIV3b4=; b=SzzFC0AiOBfLJiccaTg0OXYW9OlSKMNq9p9T4VgTuB0aJRDFe6DE+61AaVJ3uimvPE Xi4b01TnSu5jL3QNDABarkoAyEiyqnpY1c/88m9/C0jeEyHLG/iYdZV/zxESyyDjblb/ BeRBSIiniQgyfUZ8jq3IIZpvLkOCbGeK7uBKCoU+5yc9y40TVT/eEhwhT0k3DUtl9yye PSC56jA0BVifnIwTn4QY4g3UilrBAC05rY9rbzX6JYaGNEwxgyPuOO45vN2We96CTBZr sufhe0kxPIAsAtXes/r3Mz/NHgqvZw6cePF99DNVG+WI+C1+xtETokaQtq3qnaJxBTO2 k64A== X-Gm-Message-State: AOJu0YzizMNz97T3uglNOEJcsigq54RRu3vQDqOLHhuS3Tjp7iQ/Cgqp kHDMWeuS8iZymnBFvMLcdFynCBMhtS/h6Tg1C1o8+N9fJTB5PIod8/dGLZ6zttxl5BE+3VZh584 1ed5zLdI10oW30wtT12EMI8jxw4ktBmhWPXU/6B6T/58UHom6XplQCUjAjo3SGPfK9LpeMU+s6c L8wVSW7JXcJgBOmZbx7ybBYcy/nwPb3tSCAnrwiE6YaA== X-Received: by 2002:a05:600c:4f95:b0:426:6ea8:5037 with SMTP id 5b1f17b1804b1-429dd267cf3mr1802605e9.37.1723571615033; Tue, 13 Aug 2024 10:53:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWEP2aQv+K1LK9qnvpuPYsWRkEZR0+rtc1+L4PUq5l7PErkvt5SdsnKe2cCqyqEqOLmusaEg== X-Received: by 2002:a05:600c:4f95:b0:426:6ea8:5037 with SMTP id 5b1f17b1804b1-429dd267cf3mr1802445e9.37.1723571614470; Tue, 13 Aug 2024 10:53:34 -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-4290c74a96bsm236896665e9.24.2024.08.13.10.53.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 10:53:34 -0700 (PDT) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1sdvhT-004ucw-PV for libc-alpha@sourceware.org; Tue, 13 Aug 2024 17:52:51 +0000 Date: Tue, 13 Aug 2024 17:52:51 +0000 (UTC) From: Joseph Myers To: libc-alpha@sourceware.org Subject: Test errno setting on strtod overflow in tst-strtod-round Message-ID: <988bfab3-349b-962f-4ba2-2bcb2051f6f4@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~incoming=patchwork.ozlabs.org@sourceware.org We have no tests that errno is set to ERANGE on overflow of strtod-family functions (we do have some tests for underflow, in tst-strtod-underflow). Add such tests to tst-strtod-round. Tested for x86_64. diff --git a/stdlib/tst-strtod-round-skeleton.c b/stdlib/tst-strtod-round-skeleton.c index 6fba4b5228..184ec07b67 100644 --- a/stdlib/tst-strtod-round-skeleton.c +++ b/stdlib/tst-strtod-round-skeleton.c @@ -21,6 +21,7 @@ declared in the headers. */ #define _LIBC_TEST 1 #define __STDC_WANT_IEC_60559_TYPES_EXT__ +#include #include #include #include @@ -205,7 +206,9 @@ struct test { #define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ { \ feclearexcept (FE_ALL_EXCEPT); \ + errno = 0; \ FTYPE f = STRTO (FSUF) (s, NULL); \ + int new_errno = errno; \ if (f != expected->FSUF \ || (copysign ## CSUF) (1.0 ## LSUF, f) \ != (copysign ## CSUF) (1.0 ## LSUF, expected->FSUF)) \ @@ -254,6 +257,13 @@ struct test { printf ("ignoring this exception error\n"); \ } \ } \ + if (overflow->FSUF && new_errno != ERANGE) \ + { \ + printf (FNPFXS "to" #FSUF \ + " (" STRM ") did not set errno to ERANGE\n", \ + s); \ + result = 1; \ + } \ } \ }