From patchwork Fri Feb 24 16:37:53 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: 61394 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1012733wrd; Fri, 24 Feb 2023 08:38:56 -0800 (PST) X-Google-Smtp-Source: AK7set/XqwLc3ZVxXG4ftCYPCeKNsD6eAQfEJ0PPGlBXQija5aOjTuNswBqXpa/18gdLZlgL0d3N X-Received: by 2002:a05:6402:12d9:b0:4ad:71bd:67c9 with SMTP id k25-20020a05640212d900b004ad71bd67c9mr17515357edx.25.1677256736817; Fri, 24 Feb 2023 08:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677256736; cv=none; d=google.com; s=arc-20160816; b=K5zYRK1ZhGPYgiwd42Nc9W3w9zs/OzD9+cEuu3OSw2mVjKxrszkX2BVtehbtg7L+x+ KvetCynODdTnUR7o7cZWrMQef4nrthut86QYFnowpgpPflJTciHflsusJKQ/f5gEF+es MdHrXXi9eZxUTi9h8mrxjxWsnVqsMuEv8bUAkYBqCNvmQPwFfXGaMrDs/5jiTGuoqFgl epk7aCLJYWy4Vpo+yAWoR0cstV1QByubs7iUHXb6zxWkG8f+1hoO4vkjR3LAdbUix83w ygqJ5z09Ltb163ohGSdwQhib0sFKJS/+jumhXl8GnumTkqb15yjalahTRt30gw4wGSRu LRRQ== 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:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=LXkDLKWo93RxnQWk22snl/sAOwMarkCUbq71yh43VJI=; b=MgkvVUggJUVjVC+yucuMf0E0eHDe9ms806e0EV7sT7Qp3KTChGyAOan8HIVL/yzd96 /Fa4NUzb3JBNISw1/9im1lk2echsd+bkF56JONy8W2uozm41H8QSJdM6IqMwO8hZyZD3 RmSz7ZgdKcVnb8sk0HE1ILhszMCuDJdUcEwiSLC1VH0qkCbsF/Y28MajRBQHhg9Rx+qQ cs+WvbwF81Xk0mHBIhQJX1NdxCuP4VnEB1EU/6nDqViDxdCBZ0hEnSyYWW4lONHRvd9d y525rz3HWwOgfhRf9cAJ7iP46qkzihDOSGZL2Rc//k+Nysj7YfQxYn4Ft2uq/H0J1LCL Ey8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=iCCFYcQ9; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id vz23-20020a17090704d700b008b32ee5f40asi19686707ejb.399.2023.02.24.08.38.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 08:38:56 -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=iCCFYcQ9; 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 A0C04385B528 for ; Fri, 24 Feb 2023 16:38:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0C04385B528 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677256719; bh=LXkDLKWo93RxnQWk22snl/sAOwMarkCUbq71yh43VJI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=iCCFYcQ9Kwy9Vyt54zaUBXH89Ru497AJZArtjieMUs9/ayrWY692JLxyt7KDrKY1X LKW+uSaJGmVKepdlDH9mceNXJ0Ac2Swc1TSESx1UdIido+EIxM8EZA8Cb11YBJ7698 Db69hcjhph67FfPXDj2XhumyLRHWxyBVrcFcRg7k= 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 6E2DE385B531 for ; Fri, 24 Feb 2023 16:37:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E2DE385B531 To: Subject: [PATCH] testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828 MIME-Version: 1.0 Message-ID: <20230224163753.8649920423@pchp3.se.axis.com> Date: Fri, 24 Feb 2023 17:37:53 +0100 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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?1758731160342283552?= X-GMAIL-MSGID: =?utf-8?q?1758731160342283552?= Ok to commit? I suggest that when committed I'll also set the bugzilla entry in SUSPENDED mode, as opposed to RESOLVED. I mean, the issue isn't really solved; that'd be a patch improving pointer tracking across ivopts. -- >8 -- For cris-elf before this patch, ever since it was added, this test gets: Running /x/gcc/testsuite/gcc.dg/dg.exp ... FAIL: gcc.dg/Wuse-after-free-2.c (test for warnings, line 115) FAIL: gcc.dg/Wuse-after-free-2.c (test for warnings, line 116) and comparing tree dumps with a native x86_64-pc-linux-gnu run shows a suspicious difference in the "180t.ivopts" dump. Indeed -fno-ivopts makes the warning appear for cris-elf too. It was suggested to simply add -fno-ivopts to the test-flags, like before -fno-tree-loop-distribute-patterns was added; thus. PR tree-optimization/108828 * gcc.dg/Wuse-after-free-2.c: Add -fno-ivopts. --- gcc/testsuite/gcc.dg/Wuse-after-free-2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/Wuse-after-free-2.c b/gcc/testsuite/gcc.dg/Wuse-after-free-2.c index 68ec75845cec..ebc051690db5 100644 --- a/gcc/testsuite/gcc.dg/Wuse-after-free-2.c +++ b/gcc/testsuite/gcc.dg/Wuse-after-free-2.c @@ -1,6 +1,6 @@ /* PR middle-end/104232 - spurious -Wuse-after-free after conditional free { dg-do compile } - { dg-options "-O2 -Wall -fno-tree-loop-distribute-patterns" } */ + { dg-options "-O2 -Wall -fno-tree-loop-distribute-patterns -fno-ivopts" } */ void free (void*); @@ -108,7 +108,8 @@ int warn_cond_loop (char *p) char *q = p; /* -fno-tree-loop-distribute-patterns ensures this does not get converted - into rawmemchr (making q and p unrelated). */ + into rawmemchr (making q and p unrelated). Also, -fno-ivopts is required + for some targets, to not lose track of the pointer. */ while (*q) ++q;