From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1677256675; x=1708792675; h=from:to:subject:mime-version:content-transfer-encoding: message-id:date; bh=LXkDLKWo93RxnQWk22snl/sAOwMarkCUbq71yh43VJI=; b=BtqhvqRIgpLaGaP3uteWaTOIrPY56pIEmV2lqPdynkKR9MfEnTo2V9uG 0a9UVVQbpmpuN9glucelgw5PsR1qAtkA2E3LBz2pSP8ss7P0f80QwfKBs DV9TXCRi07SBuXYy0CBbUAMNIZBzESEbKkngvSdNvRSyXqmmybzqqkbz7 5cM2gKzMB7Ma8ixW8OJb+tNA9JYEKfXnwYaiBhM1Ocj5gUWcEKYKSQ585 KaFTZtj2KiFYt/EYzfKp9wVSot/ntR1AqCvI0MxLVA8qwQxsxCqLFR1nd L8FkOnPrYVQU2yZCaB7R2BVlbUMhroAVDVJcW3uaR4XZF3zzDt9V36O6w A==; From: Hans-Peter Nilsson To: Subject: [PATCH] testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT 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 List-Id: 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; -- 2.30.2