From patchwork Tue Jun 30 16:43:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1320001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=mDkK8WEw; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49x9DL5BRQz9sR4 for ; Wed, 1 Jul 2020 02:44:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 609B8385703A; Tue, 30 Jun 2020 16:43:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 609B8385703A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593535436; bh=w4152A8dZRcfJYmtP4SMcyZx28DBb9yRj0LiUaDTyBM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=mDkK8WEwjNkLAXXm1XGbxERMWnmXovPbg3Xr58mCypieLvNmJQw8kYebQxxV3h8mL 5+pfB8THNMboAjZJYirOANy9z2LzTimzEfAv2L8XTX7/ZB3r66UNamVaM0l4H93XW9 GUmzmAY8RarwLO2en707hajE/NRZKL5pnyPrJ5ws= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id B3BA4385701D for ; Tue, 30 Jun 2020 16:43:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B3BA4385701D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-lUxYUs_BMqeoZQPTnaMOwA-1; Tue, 30 Jun 2020 12:43:50 -0400 X-MC-Unique: lUxYUs_BMqeoZQPTnaMOwA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE66F80401F; Tue, 30 Jun 2020 16:43:49 +0000 (UTC) Received: from localhost (unknown [10.33.36.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BC132B583; Tue, 30 Jun 2020 16:43:49 +0000 (UTC) Date: Tue, 30 Jun 2020 17:43:48 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH] analyzer: Fix -Wanalyzer-possible-null-argument warning Message-ID: <20200630164348.GA3500050@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-13.3 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_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Cc: dmalcolm@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/testsuite/ChangeLog: * g++.dg/analyzer/pr94028.C: Make operator new non-throwing so that the compiler doesn't implicitly mark it as returning non-null. Fixes these: FAIL: g++.dg/analyzer/pr94028.C -std=c++98 (test for excess errors) FAIL: g++.dg/analyzer/pr94028.C -std=c++14 (test for excess errors) FAIL: g++.dg/analyzer/pr94028.C -std=c++17 (test for excess errors) FAIL: g++.dg/analyzer/pr94028.C -std=c++2a (test for excess errors) OK for master? commit 34e9c12533c6313d37f56900876e41f69e8474bc Author: Jonathan Wakely Date: Tue Jun 30 17:40:08 2020 +0100 analyzer: Fix -Wanalyzer-possible-null-argument warning gcc/testsuite/ChangeLog: * g++.dg/analyzer/pr94028.C: Make operator new non-throwing so that the compiler doesn't implicitly mark it as returning non-null. diff --git a/gcc/testsuite/g++.dg/analyzer/pr94028.C b/gcc/testsuite/g++.dg/analyzer/pr94028.C index 0a222d1b991..c0c35d65829 100644 --- a/gcc/testsuite/g++.dg/analyzer/pr94028.C +++ b/gcc/testsuite/g++.dg/analyzer/pr94028.C @@ -12,7 +12,7 @@ enum e {} i; struct j { - void *operator new (__SIZE_TYPE__ b) + void *operator new (__SIZE_TYPE__ b) throw() { return calloc (b, sizeof (int)); // { dg-warning "leak" } }