From patchwork Fri Jul 21 15:16:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1810979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gotplt.org header.i=@gotplt.org header.a=rsa-sha256 header.s=dreamhost header.b=SDjRR2HF; dkim-atps=neutral Received: from server2.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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R6tSx5LG6z1yYm for ; Sat, 22 Jul 2023 01:17:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 311F2386F827 for ; Fri, 21 Jul 2023 15:17:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from buffalo.ash.relay.mailchannels.net (buffalo.ash.relay.mailchannels.net [23.83.222.24]) by sourceware.org (Postfix) with ESMTPS id A4D0E3853D09 for ; Fri, 21 Jul 2023 15:16:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4D0E3853D09 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3A0E54C119A; Fri, 21 Jul 2023 15:16:46 +0000 (UTC) Received: from pdx1-sub0-mail-a286.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id D0D784C1BAA; Fri, 21 Jul 2023 15:16:45 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1689952605; a=rsa-sha256; cv=none; b=diKJP+w6M2A/imKrK+H0ReiKgfOMDjeHUkjtfEUFTVgZ99BteAKiJ5Oke2jK68yi0Anuss Q+Qy0eF3fD5xcyig/7xOvYGvdKKRkujET92xnPBrn0K+wzYbwu+k8g7rD0BKmVwTRqzTwZ gsFMb0TYJuvvTI/ySo+ISfHVKZw8hE2KjN2yxyKOJSp6fT5v+hgGcWQGj7ohH227ICoO2b wW3ERsJVM4etydC+OKHyUweHymNwF2NCmb/pQ1lBaK7flGzde+TGdWxv5r82tiGWCqFpa+ nt4RF+qR0sA8h5UQUCwTtDDvCPjfpWdrTwk5anz3Q7sm3Tc5p3DLNcX3T+BDaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1689952605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=/nIUkF2yz13fPuYvSencU2spj5KvGKz40mTJexrbjuQ=; b=JUqNekXXOzm18J5l8AIlSD/tnqXxUP6YX9ygCjHrfUFP+/7Ll3HvgsK8r0m7FeHDSNksB3 tVdqParLYcUiQmfMi6QuD6WiZkEjMThtzDtJgKB8Sb2FVczhq1B2q9NT4PtdYgt8fFWPV7 GA2p11T3mR9CA106HeEFmTW9qB8ETIgM96QRqvMdZ+bJwS/ZWB0EgVETUoxWPWI20fXl6e ciW61mA3sG1dOnp6pZKlgYCw6zO2gktm9cG9YbzdlPVd1AgSNYUvLQq3T1tMnvZDZHUKed mNEZSuJIdBqsvCe/raqN8uIIuor5fdY//kbBYA4bu46ZDJ+UckE6kSdn0Puj4w== ARC-Authentication-Results: i=1; rspamd-59bd44d99d-rgxwv; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Broad-White: 4483add101854df5_1689952606074_820548949 X-MC-Loop-Signature: 1689952606074:1128580111 X-MC-Ingress-Time: 1689952606074 Received: from pdx1-sub0-mail-a286.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.107.136.31 (trex/6.9.1); Fri, 21 Jul 2023 15:16:46 +0000 Received: from fedora.. (bras-vprn-toroon4834w-lp130-09-174-91-45-44.dsl.bell.ca [174.91.45.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a286.dreamhost.com (Postfix) with ESMTPSA id 4R6tSY36XwzNw; Fri, 21 Jul 2023 08:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1689952605; bh=/nIUkF2yz13fPuYvSencU2spj5KvGKz40mTJexrbjuQ=; h=From:To:Cc:Subject:Date:Content-Transfer-Encoding; b=SDjRR2HF9JFiwWO7rn1c9s159KrIK7ZgcZnbZqr6QVTO3vguLdW/eShuEz2Qs+A86 KOAK8Tv81E3qoNlUm4I36Vx7pxbHSjOQyAoCa0ORWvFj9jfI6pRhRrZGmiqPLyPzMa 18MZHlF73HEPeWg1Pxtx9S580ZlNudk9Gw1Vm53fcjaAarjgIGsoH3Yywo0c3MJkcO I1H0xYIuMaBAG/ieZoP/qkKgsOwW40cqjDIo1A76Y4HKzyYTew2W//dNvWlYfeomeU o+5cHSCUtZ6fLDfgBeR965HZ7LpOIC7qsmDAwxjojYvuifMBGGjZCxGRtiDeqwfCFT 1LsZFmXM0kFIA== From: Siddhesh Poyarekar To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de Subject: [PATCH] testsuite/110763: Ensure zero return from test Date: Fri, 21 Jul 2023 11:16:26 -0400 Message-ID: <20230721151626.67206-1-siddhesh@gotplt.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3036.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The test deliberately reads beyond bounds to exersize ubsan and the return value may be anything, based on previous allocations. The OFF test caters for it by ANDing the return with 0, do the same for the DYN test. gcc/testsuite/ChangeLog: PR testsuite/110763 * gcc.dg/ubsan/object-size-dyn.c (dyn): New parameter RET. (main): Use it. Signed-off-by: Siddhesh Poyarekar --- gcc/testsuite/gcc.dg/ubsan/object-size-dyn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.dg/ubsan/object-size-dyn.c b/gcc/testsuite/gcc.dg/ubsan/object-size-dyn.c index 0159f5b9820..49c3abe2e72 100644 --- a/gcc/testsuite/gcc.dg/ubsan/object-size-dyn.c +++ b/gcc/testsuite/gcc.dg/ubsan/object-size-dyn.c @@ -5,12 +5,12 @@ int __attribute__ ((noinline)) -dyn (int size, int i) +dyn (int size, int i, int ret) { __builtin_printf ("dyn\n"); fflush (stdout); int *alloc = __builtin_calloc (size, sizeof (int)); - int ret = alloc[i]; + ret = ret & alloc[i]; __builtin_free (alloc); return ret; } @@ -28,7 +28,7 @@ off (int size, int i, int ret) int main (void) { - int ret = dyn (2, 2); + int ret = dyn (2, 2, 0); ret |= off (4, 4, 0);