From patchwork Tue Feb 28 18:47:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 62578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3189774wrd; Tue, 28 Feb 2023 10:48:43 -0800 (PST) X-Google-Smtp-Source: AK7set+nlIly2KdXG54uVIkp/cQ/caI9hMfyZCebZ7yAoDjaFLZHqZ3JD3qrwh0VSRQe6Krr175U X-Received: by 2002:a17:906:b00d:b0:8b1:7b5d:fe9b with SMTP id v13-20020a170906b00d00b008b17b5dfe9bmr3911522ejy.28.1677610122941; Tue, 28 Feb 2023 10:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677610122; cv=none; d=google.com; s=arc-20160816; b=fknvCNYmg1VcHvI7hbOU2ZFxqAdUcRJezyRnj28OIo9VCPeITGAMzTJHVD12OJdMFZ bGYZtOEZwxm1+b8Y/Pd/oCe1NYGXH64zIy24RMWczbmc4oYmAAqLLAELSN9LLLe6LFq/ GAWwPdsmCsrE7GXTDBLLoys8vbRzbH1T0iC7vok2yLaRS5oPL7aje/3JG7Q94sBVUJAH RfP3NFg8Bf86qDhcPpy+XXKjWHsQIfuxTV0JeUzw0DZzwIjITz3aCc+fCIc35mgAMAqw tierUo1EjAEhLWhR90i0wmYZnhLQjMUo5umkpZkz9SenLDSwK1T1MMrcIX2Uj4k1n9g6 LpRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:date:message-id :content-transfer-encoding:mime-version:subject:cc:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=jmw7c91O3FG5p3HME1YQ2YImHLpDWeFqxeT1JgvGWxM=; b=XVo434MV9olY+jOeEeTPGoH3QGSoHL5La4dNHVQE26rmSgIzAEhhfVKjgeLBS2c0Bx NJmRiB5v4NQMSXqP/tIsP+0eX5OvuXVdl5l85JFAHhqYtvCqMxOJqwVQxM92Fy6xrUDz ndFRJRxL6y9nma6/Lj5Q+/bIuIQT/K76ivMphafoegHz2Obnnt8xBIEo2eRhBhL7/1co 4MrDEBI5GDUwwaobP5HlXQQc+FJU5/4+okT4QUP9B84UBX5fJV2dojl4m8ppS/L6qcUT Fpmmy4Emskhb92F4vSkPwD6kXXEiBX6rYxFAWiEEMcwS4x36pzz+GEgM4tyuyAV1980k mlRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=m4GDwxpu; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id by23-20020a170906a2d700b008ddf3c182fesi11815487ejb.313.2023.02.28.10.48.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 10:48:42 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=m4GDwxpu; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC7793858C62 for ; Tue, 28 Feb 2023 18:48:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC7793858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677610121; bh=jmw7c91O3FG5p3HME1YQ2YImHLpDWeFqxeT1JgvGWxM=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=m4GDwxpuk5acKPFJrvuIodfXUSq2TtwILSqdhhvPqYUQv2487+dQR35IX0e8Nj9K3 yCKFfZrxQEsBYMOBWhjrPTAY9brr6yqu1GbwXq+Tlfh+QShrf8a+nCstPxR4mk6qXe H4Mvz2rtN+mnSv2MUzJTa3c8sKM8RSfQl9aSYPqw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id EF8693858D33 for ; Tue, 28 Feb 2023 18:47:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF8693858D33 To: CC: Subject: [PATCH 1/2] testsuite: Fix analyzer errors for newlib-errno MIME-Version: 1.0 Message-ID: <20230228184735.24E6E20438@pchp3.se.axis.com> Date: Tue, 28 Feb 2023 19:47:35 +0100 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hans-Peter Nilsson via Gcc-patches From: Hans-Peter Nilsson Reply-To: Hans-Peter Nilsson Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759101712473723000?= X-GMAIL-MSGID: =?utf-8?q?1759101712473723000?= Ok to commit? -- >8 -- Investigating analyzer tesstsuite errors for cris-elf. The same are seen for pru-elf according to posts to gcc-testresults@. For glibc, errno is #defined as: extern int *__errno_location (void) __THROW __attribute_const__; # define errno (*__errno_location ()) while for newlib in its default configuration, it's: #define errno (*__errno()) extern int *__errno (void); The critical difference is that __attribute__ ((__const__)), where glibc says that the caller will see the same value on all calls (from the same context; read: same thread). I'm not sure the absence of __attribute__ ((__const__)) for the newlib definition is deliberate, but I guess it can. Either way, without the "const" attribute, it can't be known that the same location will be returned the next time, so analyzer-tests that depend the value being known it should see UNKNOWN rather than TRUE, that's why the deliberate check for UNKNOWN rather than xfailing the test. For isatty-1.c, it's the same problem, but here it'd be unweildy with the extra dg-lines, so better just skip it for newlib targets. testsuite: * gcc.dg/analyzer/call-summaries-errno.c: Expect UNKNOWN for newlib after having set errno. * gcc.dg/analyzer/errno-1.c: Ditto. * gcc.dg/analyzer/isatty-1.c: Skip for newlib targets. --- gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c | 3 ++- gcc/testsuite/gcc.dg/analyzer/errno-1.c | 3 ++- gcc/testsuite/gcc.dg/analyzer/isatty-1.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c b/gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c index e4333b30bb77..cf4d9f7141e4 100644 --- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c +++ b/gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c @@ -13,5 +13,6 @@ void test_sets_errno (int y) sets_errno (y); sets_errno (y); - __analyzer_eval (errno == y); /* { dg-warning "TRUE" } */ + __analyzer_eval (errno == y); /* { dg-warning "TRUE" "errno is at a constant location" { target { ! newlib } } } */ + /* { dg-warning "UNKNOWN" "errno is not known to be at a constant location" { target { newlib } } .-1 } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-1.c b/gcc/testsuite/gcc.dg/analyzer/errno-1.c index 6b9d28c10799..af0cc3d52a36 100644 --- a/gcc/testsuite/gcc.dg/analyzer/errno-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/errno-1.c @@ -17,7 +17,8 @@ void test_storing_to_errno (int val) { __analyzer_eval (errno == val); /* { dg-warning "UNKNOWN" } */ errno = val; - __analyzer_eval (errno == val); /* { dg-warning "TRUE" } */ + __analyzer_eval (errno == val); /* { dg-warning "TRUE" "errno is at a constant location" { target { ! newlib } } } */ + /* { dg-warning "UNKNOWN" "errno is not known to be at a constant location" { target { newlib } } .-1 } */ external_fn (); __analyzer_eval (errno == val); /* { dg-warning "UNKNOWN" } */ } diff --git a/gcc/testsuite/gcc.dg/analyzer/isatty-1.c b/gcc/testsuite/gcc.dg/analyzer/isatty-1.c index 389d2cdf3f18..450a7d71990d 100644 --- a/gcc/testsuite/gcc.dg/analyzer/isatty-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/isatty-1.c @@ -1,4 +1,4 @@ -/* { dg-skip-if "" { powerpc*-*-aix* } } */ +/* { dg-skip-if "" { powerpc*-*-aix* || newlib } } */ #include #include "analyzer-decls.h" From patchwork Tue Feb 28 18:49:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 62579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3190688wrd; Tue, 28 Feb 2023 10:50:43 -0800 (PST) X-Google-Smtp-Source: AK7set9Rf6qUTeDBAIFLZwuSMMH7VhTSy6l1H6EkTrFK2Nx4LaqTp249Tti5ZbH9noMtTZFklZEK X-Received: by 2002:a17:906:3848:b0:8b1:7b5e:4a74 with SMTP id w8-20020a170906384800b008b17b5e4a74mr3779473ejc.37.1677610243135; Tue, 28 Feb 2023 10:50:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677610243; cv=none; d=google.com; s=arc-20160816; b=b1/FE4r6LPn9wB/qkN9nLuYVyd8lCtFvG3BxMKpBmjWA6KyTdfzNnbuERazKKikNNm +Y8mps+v4rGGOxpRQHlXx9LX+Sn0ZovcaXeaKjLF6SfTofHgvxalNxSkEwcxljckqqE2 ycLaHFN0vdIUYOkRIFU3dHHRpqugjXOOpL25rDpndzMsCCSA1vy991vU0nUje6Euds1E oOSLNKCdM3wv9NWuG322BzRYjspiUBbr65NAnDAhCIk9RaDIJuCYaj3hWlMdlQA31nux EN1Y13RDTUAq95AN9M3RSENW7v1zy6fmPMxIm+z0jmYO0zNxoQLnbTXROSWoXTLDo9HE d3nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:date:message-id :content-transfer-encoding:mime-version:subject:cc:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=l304sRblOdy1REysji+cb8yzsUk4POP2GrYB3w2L/Gk=; b=eenwC4lmDqyudPrSHQzfX7VswAk33JLbXUCkQy92EhG0TdhwPbrdIvK4gDS2iyuMdb lVEevgzoUKQSwOAEUTNS4UXwKIlNqpXH6zcRTJC1KheUlaSbCLyt7lfeMapPS9OArBk6 Z/OIo8VDPorRAwwnTuIwFZGFRqSP7puo25ZpCbXL4eZt2QuEQuWAkBqIk5jA7L5PaoGr 4PbljJ3KdE9zMExH1SootdkkpXh3vp4J/83wAngW4P8ShNqzn6aVAZYZl0qvjWJqpRNh W/rXYLo/JnlClrrbQRlJ16BvN659t/kV2J9QifwyPzuKgAHTmZjfJfDjnB/2c5eGr3mU f6jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=vFe3Sc5d; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id z17-20020a170906815100b008e4263a2e52si3362183ejw.228.2023.02.28.10.50.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 10:50:43 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=vFe3Sc5d; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 29BC13858C50 for ; Tue, 28 Feb 2023 18:50:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29BC13858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677610242; bh=l304sRblOdy1REysji+cb8yzsUk4POP2GrYB3w2L/Gk=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=vFe3Sc5dMp1FfnlxnM6IDGVp6iovZ3utszQUgkMVlHYCn2N5gBi3jVdFaXGwF60Zm LbhisdTmgK1OizpV8c8dPnOzXMyf/W5+cSsVskiRtFU6xCyuksOCQSN7ZMaaonSoG/ UYE0GER3nqpAXHrw/g4BTq/YP6mrijkDes/eJFlw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by sourceware.org (Postfix) with ESMTPS id A76D23858D33 for ; Tue, 28 Feb 2023 18:49:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A76D23858D33 To: CC: Subject: [PATCH 2/2] testsuite: Fix analyzer errors for newlib-fd MIME-Version: 1.0 Message-ID: <20230228184958.4992D20438@pchp3.se.axis.com> Date: Tue, 28 Feb 2023 19:49:58 +0100 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hans-Peter Nilsson via Gcc-patches From: Hans-Peter Nilsson Reply-To: Hans-Peter Nilsson Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759101838560953019?= X-GMAIL-MSGID: =?utf-8?q?1759101838560953019?= Ok to commit? (After this, there's gcc.dg/analyzer/flex-without-call-summaries.c left to do.) -- >8 -- Investigating analyzer testsuite errors for cris-elf. The same are seen for pru-elf according to posts to gcc-testresults@. The test fd-access-mode-target-headers.c uses the analyzer "sm-fd" which for this use requires (e.g.) that constants O_ACCMODE, O_RDONLY and O_WRONLY are defined as literal constants. While for glibc, O_ACCMODE is defined as: #define O_ACCMODE 0003 in newlib, it's defined as: #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) and the analyzer is not able to make use of an expression like this (even though O_RDONLY, O_WRONLY and O_RDWR are defined as literal constants and the whole evaluates to 3). Better do as for AIX and skip this test. testsuite: * gcc.dg/analyzer/fd-access-mode-target-headers.c: Skip for newlib targets too. --- gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c b/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c index 847d47e06342..cf273b217d17 100644 --- a/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c +++ b/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c @@ -1,4 +1,4 @@ -/* { dg-skip-if "" { powerpc*-*-aix* } } */ +/* { dg-skip-if "" { powerpc*-*-aix* || newlib } } */ #include #include