Message ID | 20231121232704.12336-3-palmer@rivosinc.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 94012385842A for <patchwork@sourceware.org>; Tue, 21 Nov 2023 23:28:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 149593858C36 for <gcc-patches@gcc.gnu.org>; Tue, 21 Nov 2023 23:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 149593858C36 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 149593858C36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::633 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700609319; cv=none; b=x7aT4wvWI5ytDW63W6GO9MdVeNT4ghnLMDDktBbJdgq+MQjvwks8y7GFN2DM0TBtjce1kz02vNEfdhmLGjtzQWFRfE7fSHxT3J+GSzVh0wXYeXOIwu6Z7DkYSqobwZoamL4nqaPu1WAsoy2SNg4jp2pUgS4c68vC/UcpZN9tAps= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700609319; c=relaxed/simple; bh=7Tcz/OzMBCbMqMMHwZMC+7xAx4cdC3IU03yh1KgmuYI=; h=DKIM-Signature:Subject:Date:Message-ID:MIME-Version:From:To; b=dKbQTjCWiQQiA+bK6CX4Lbi7VhW64OswuDUC9l7LZyY/IxcnTL5mCAZkUpJRpIUEcgbPCFiw/EmePX4S/tArAYBi5y5aCeOxuX88ZpTnWwomSD52QeheUBY7xkKnWLjU7Pn/B+F7HxbeHfO59PK3fzV/U4+IFVk9Sf+M7GjNq2M= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1cc2fc281cdso43302285ad.0 for <gcc-patches@gcc.gnu.org>; Tue, 21 Nov 2023 15:28:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1700609317; x=1701214117; darn=gcc.gnu.org; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date:message-id:reply-to; bh=hlksFMkqhHJ/wZjl/sWDSyNorZ+ufY24yZbTPo1UokI=; b=rx4g/cPZWnUitLS6MK7HFlCnujpW8NC3a0gOQYbpEPZmNEdeTJGKp+P/9HpQeLsROY GNgtLPvPUvnabRZjOMzKEmfyPsgtCPAggdChvfuKLpQWW71nYk/gTiw0zbPsdQ/74H5q PDQ8DY36f56tJxX8V8sjsg0k+acXpUjTNrDTdSIpI2Q2N5qUMjKTi2a2D4hSOoRLH+sx Rf0tdEffcE0pXfbrOjtNomSIr6+2H0m0qO52WMBxuqyp8QNgcZMcgfJtptj88ONLfN35 khSczA/SpjtkJp/d+yzesajBeHr8XmWf8K3Ge5C2f8zBgWYvoF2fL1wIG/taMFl7ttjv vHLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700609317; x=1701214117; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hlksFMkqhHJ/wZjl/sWDSyNorZ+ufY24yZbTPo1UokI=; b=KEMcIiyub3z/lvpzG0kPmJM8PGfpIimic+1iivOJDpybaRuRxKDlopK1E7euC9BMJS leGQY4tMfRAfQONB7K2V4CEqets0Da/L0ZYKaiQPHqlUl8mb27rLGsUKztsaU1lAfXv4 JxSDE1yy/Ga0NDAsDnMXO8w7wjfz34oA/pmIrbmYadmpv5i5ApRxkRHCqbbRrdxIH7Pf LfgiKWp1ZCDVVVUTx9I4KLOFDSGLIkAF52by5HxaQAYTs4gPE32IaIa8lTYs/6ix9GBv WWTlezcWdFhSxw7A2VcaTymyjcwOB+3y9DS0l0wb+PBW60lD+IYROVdcgoiuYgwvI2/u BcKQ== X-Gm-Message-State: AOJu0YwChQ9Mchinh4NCZr939X5fs81EUiROkoqREclhGFY2aayL21hL qRP9XgEeLFAmotDdEW2INvqegA== X-Google-Smtp-Source: AGHT+IFYTjYjATV/ULBWLOUXI0aFTh6gxaez9Uiawp3hCH5etN3JPWkG8e9+PfCCO6yuJq5CuDS4vA== X-Received: by 2002:a17:902:a411:b0:1cf:677b:6c2b with SMTP id p17-20020a170902a41100b001cf677b6c2bmr556429plq.29.1700609316881; Tue, 21 Nov 2023 15:28:36 -0800 (PST) Received: from localhost ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id jc12-20020a17090325cc00b001cf639e5ca6sm3781278plb.307.2023.11.21.15.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 15:28:36 -0800 (PST) Subject: [PATCH 1/2] testsuite/unroll-8: Avoid triggering undefined behavior Date: Tue, 21 Nov 2023 15:27:05 -0800 Message-ID: <20231121232704.12336-3-palmer@rivosinc.com> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Palmer Dabbelt <palmer@rivosinc.com> From: Palmer Dabbelt <palmer@rivosinc.com> To: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org |
Series |
[1/2] testsuite/unroll-8: Avoid triggering undefined behavior
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gcc_build--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 | success | Testing passed |
Commit Message
Palmer Dabbelt
Nov. 21, 2023, 11:27 p.m. UTC
I was poking around with this test failure and noticed it was exercising undefined behavior. The return type doesn't matter for what's being tested, so just mark it as void. gcc/testsuite/ChangeLog: * gcc.dg/unroll-8.c: Remove UB. --- I didn't tes this, but it seems trivial enough that I'm just going to throw it at the bots and hope I'm right. --- gcc/testsuite/gcc.dg/unroll-8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/21/23 16:27, Palmer Dabbelt wrote: > I was poking around with this test failure and noticed it was exercising > undefined behavior. The return type doesn't matter for what's being > tested, so just mark it as void. > > gcc/testsuite/ChangeLog: > > * gcc.dg/unroll-8.c: Remove UB. I just reviewed the history of unroll-8, I don't think this compromises the test's original intent. OK for the trunk. jeff
On Tue, Nov 21, 2023 at 3:29 PM Palmer Dabbelt <palmer@rivosinc.com> wrote: > > I was poking around with this test failure and noticed it was exercising > undefined behavior. The return type doesn't matter for what's being > tested, so just mark it as void. Just a quick note, this is NOT undefined behavior in C to return without a value from a function which has a non-void return type. It is only undefined if the value was used. It is undefined behavior in C++ though for a fallthrough. Yes there is a difference in the language. As Jeff said it does not change what the testcase was/is testing but we should be clear in the changelog that this is NOT undefined behavior. Thanks, Andrew Pinski > > gcc/testsuite/ChangeLog: > > * gcc.dg/unroll-8.c: Remove UB. > --- > I didn't tes this, but it seems trivial enough that I'm just going to > throw it at the bots and hope I'm right. > --- > gcc/testsuite/gcc.dg/unroll-8.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/testsuite/gcc.dg/unroll-8.c b/gcc/testsuite/gcc.dg/unroll-8.c > index 4388f47d4c7..06d32e56893 100644 > --- a/gcc/testsuite/gcc.dg/unroll-8.c > +++ b/gcc/testsuite/gcc.dg/unroll-8.c > @@ -3,7 +3,7 @@ > /* { dg-additional-options "-fno-tree-vectorize" { target amdgcn-*-* } } */ > > struct a {int a[7];}; > -int t(struct a *a, int n) > +void t(struct a *a, int n) > { > int i; > for (i=0;i<n;i++) > -- > 2.42.1 >
diff --git a/gcc/testsuite/gcc.dg/unroll-8.c b/gcc/testsuite/gcc.dg/unroll-8.c index 4388f47d4c7..06d32e56893 100644 --- a/gcc/testsuite/gcc.dg/unroll-8.c +++ b/gcc/testsuite/gcc.dg/unroll-8.c @@ -3,7 +3,7 @@ /* { dg-additional-options "-fno-tree-vectorize" { target amdgcn-*-* } } */ struct a {int a[7];}; -int t(struct a *a, int n) +void t(struct a *a, int n) { int i; for (i=0;i<n;i++)