From patchwork Wed Feb 1 02:27:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 64065 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 753F03858C62 for ; Wed, 1 Feb 2023 02:28:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 753F03858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675218511; bh=AOvxB1pspMNcWFjQA0zk+HvpjL6Fc0QOSajOWzqhiWE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=iKwOLfLnnpe2L3qiYn04v+eqRbicJG3Njd0FURafCPYwpPyTIijBIch+gmyMSv4VC +dA6iSOKnSD3Vsr7sy6oGJlaRJvw/xN6H5KoLeDj5xoJvcvSI1dugskbFqnyjQGHkN Rg5IdiUCtJg7Q/iQwXLtYzdojlPfOP8hH5s5XP3c= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8C8CC3858D38 for ; Wed, 1 Feb 2023 02:28:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C8CC3858D38 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-166-CxoWQMtxNsK8S3_hmGnotg-1; Tue, 31 Jan 2023 21:27:56 -0500 X-MC-Unique: CxoWQMtxNsK8S3_hmGnotg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C30D884341; Wed, 1 Feb 2023 02:27:56 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.2.17.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6788C175A2; Wed, 1 Feb 2023 02:27:56 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: NightStrike , David Malcolm Subject: [pushed] analyzer: fix uses of alloca in testsuite Date: Tue, 31 Jan 2023 21:27:55 -0500 Message-Id: <20230201022755.825041-1-dmalcolm@redhat.com> In-Reply-To: <22c944dff18fc7afeb9c8acd1d1e5d05e2cc6312.camel@redhat.com> References: <22c944dff18fc7afeb9c8acd1d1e5d05e2cc6312.camel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.5 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_H2, SPF_HELO_NONE, SPF_NONE, 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: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-5615-gd03ae4be2c6d48. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/call-summaries-2.c: Add dg-require-effective-target alloca. * gcc.dg/analyzer/imprecise-floating-point-1.c: Likewise. * gcc.dg/analyzer/infinite-recursion-alloca.c: Likewise. * gcc.dg/analyzer/malloc-callbacks.c: Likewise. * gcc.dg/analyzer/out-of-bounds-5.c: Likewise. Remove includes of and . Use "__builtin_free" rather than "free", to match uses of "__builtin_malloc". * gcc.dg/analyzer/putenv-1.c: Add dg-require-effective-target alloca. * gcc.dg/analyzer/write-to-string-literal-5.c: Likewise. Signed-off-by: David Malcolm --- gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c | 1 + .../gcc.dg/analyzer/imprecise-floating-point-1.c | 2 ++ .../gcc.dg/analyzer/infinite-recursion-alloca.c | 2 ++ gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c | 2 ++ gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c | 9 ++++----- gcc/testsuite/gcc.dg/analyzer/putenv-1.c | 1 + .../gcc.dg/analyzer/write-to-string-literal-5.c | 1 + 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c b/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c index 22ca475b2ed..2d82d02e4e2 100644 --- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c +++ b/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c @@ -1,4 +1,5 @@ /* { dg-additional-options "-fanalyzer-call-summaries --param analyzer-min-snodes-for-call-summary=0" } */ +/* { dg-require-effective-target alloca } */ /* There need to be at least two calls to a function for the call-summarization code to be used. diff --git a/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c b/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c index d8a3f4884d6..7fe09fb826b 100644 --- a/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target alloca } */ + #include /* Tests warn on use of floating-point operands inside the calculation diff --git a/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-alloca.c b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-alloca.c index 8c50631d8ce..87727e8ca25 100644 --- a/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-alloca.c +++ b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-alloca.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target alloca } */ + typedef __SIZE_TYPE__ size_t; int test_alloca_1 (void) diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c b/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c index c79f80d376d..cf3927fcaea 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target alloca } */ + #include typedef void *(*allocator_t) (size_t); diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c index eb6aae0f8cb..2a61d8ca236 100644 --- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c +++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c @@ -1,9 +1,8 @@ /* { dg-additional-options "-Wno-unused-but-set-variable" } */ +/* { dg-require-effective-target alloca } */ #include -#include #include -#include #include /* Tests with symbolic values. */ @@ -14,7 +13,7 @@ void test1 (size_t size) if (!buf) return; buf[size] = '\0'; /* { dg-warning "heap-based buffer overflow" } */ - free (buf); + __builtin_free (buf); } void test2 (size_t size) @@ -23,7 +22,7 @@ void test2 (size_t size) if (!buf) return; buf[size + 1] = '\0'; /* { dg-warning "heap-based buffer overflow" } */ - free (buf); + __builtin_free (buf); } void test3 (size_t size, size_t op) @@ -32,7 +31,7 @@ void test3 (size_t size, size_t op) if (!buf) return; buf[size + op] = '\0'; /* { dg-warning "heap-based buffer overflow" } */ - free (buf); + __builtin_free (buf); } void test4 (size_t size, unsigned short s) diff --git a/gcc/testsuite/gcc.dg/analyzer/putenv-1.c b/gcc/testsuite/gcc.dg/analyzer/putenv-1.c index 4c3f0ae2e74..543121258c8 100644 --- a/gcc/testsuite/gcc.dg/analyzer/putenv-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/putenv-1.c @@ -1,4 +1,5 @@ /* { dg-additional-options "-Wno-analyzer-null-argument" } */ +/* { dg-require-effective-target alloca } */ #include #include diff --git a/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-5.c b/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-5.c index b7ac4659012..42efc49fb22 100644 --- a/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-5.c +++ b/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-5.c @@ -2,6 +2,7 @@ notes) works. */ /* { dg-additional-options "-fanalyzer-show-duplicate-count" } */ +/* { dg-require-effective-target alloca } */ #include "analyzer-decls.h"