From patchwork Wed May 10 05:07:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 91865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3370718vqo; Tue, 9 May 2023 22:08:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ479ocOlxiVRC0Fu3lf3g7N56KSisyfbZVnGfALISuZTApUSn6aUYe94LcJILF9fwBAcTkY X-Received: by 2002:a50:ed95:0:b0:50d:a804:423 with SMTP id h21-20020a50ed95000000b0050da8040423mr7545309edr.10.1683695329335; Tue, 09 May 2023 22:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683695329; cv=none; d=google.com; s=arc-20160816; b=oNVWW8FtbqN5jO5xhAg4gNRAM2/UAtIdXYCnmYh0FgYJXblx20koI0YdxBtgdL2Tht u27GXghYHjN9mPj92QnXWzSTDbrI+lhoPd9DTfr28GmeqQ+P1ZhCtskXQXooweWuYwg7 /nj3UdSYml8nMaYh9kkYZXFsENnnh2bkEHxUzo+7EQgIHH+5LauMQp681cbvMdS+3dfi 7HmUPxyZtXlvdFiLYNj5lO7d4INnch8hYlgmK9vurjxvphSfz7cRz6Ghg9pfz5M/XA+4 ByWh3CNvBz2VjIjVuh3KCDOr83mjyxBiByAT7Zrlp145HoF5MYZ0dOYp/CG23WAqySIt FFgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=SEI2pr0d6bfy7zU2zKtqzKRcsnwwMyJRiL+VRNA897w=; b=YUlK3RhgpOwzNFHWeqh1d5rtEaGl5KWtbM9fQBxAErUS+Rcv6qJj+p4dJj3F5PlXVU KpyfEMn5WQ4+Mrx9cY8f5MqJTqUZ8MVCjug2pX2Y1Yvza+8j6+P8Y2VxxiQbvo4JOe3x WzkfvOlPPDF8MmkAdTvjNo6SolSd6JBd1ru/ZSdIN8c1th69wXYzvlOqWSnXA9q5bPoy 2GWPdzzgQNs9MPP5w7xBfn2XUb0cMPMrOhOvLDKnZ7fqEd1ZhQRJ/gJwXM9seZTJfCVQ vJljpywKYPTuT7jX/VCsTRiH5bc/kFa/zkBaX/JB0/NyjJ5yfLjyGKvi5QgW9/sRviTh lU3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uKxMpvKN; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v18-20020aa7d9d2000000b0050bca41879csi2587051eds.89.2023.05.09.22.08.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 22:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uKxMpvKN; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40C34385735C for ; Wed, 10 May 2023 05:08:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40C34385735C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683695328; bh=SEI2pr0d6bfy7zU2zKtqzKRcsnwwMyJRiL+VRNA897w=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=uKxMpvKNKqh3zhXiqV8dRkUFWjp8QhRbLzD6q4K4xZAw8bVzAqwdudsHEsIV/EpoD qX00VbcQJZmrZpz6WJEk8cTI97GhVAQN7Ai8ZEIuRk1K7Q93D9k4ZTrMw8yBAy3RHW ZeEKxA+tirowqxF1KLeFEp66stAtSvFAcbzDqZzU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id E46E43858C31 for ; Wed, 10 May 2023 05:08:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E46E43858C31 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34A1MatF019338 for ; Tue, 9 May 2023 22:08:01 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qf77veshr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 09 May 2023 22:08:00 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 9 May 2023 22:07:58 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 9 May 2023 22:07:58 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.76.242.112]) by maili.marvell.com (Postfix) with ESMTP id 078E43F7043; Tue, 9 May 2023 22:07:57 -0700 (PDT) To: CC: Andrew Pinski Subject: [Committed] New testcase Date: Tue, 9 May 2023 22:07:48 -0700 Message-ID: <20230510050748.1308816-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: IRa-3oxoJ1D8FC6y4cwmPWyks1uEpfl1 X-Proofpoint-GUID: IRa-3oxoJ1D8FC6y4cwmPWyks1uEpfl1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_02,2023-05-05_01,2023-02-09_01 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765482514026642740?= X-GMAIL-MSGID: =?utf-8?q?1765482514026642740?= While I was writting a match.pd patch, I can across GCC was being miscompiled but no testcase was failing. So this adds that testcase. Committed after testing on x86_64 with make check-gcc RUNTESTFLAGS="execute.exp=20230509-1.c" gcc/testsuite/ChangeLog: * gcc.c-torture/execute/20230509-1.c: New test. --- .../gcc.c-torture/execute/20230509-1.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20230509-1.c diff --git a/gcc/testsuite/gcc.c-torture/execute/20230509-1.c b/gcc/testsuite/gcc.c-torture/execute/20230509-1.c new file mode 100644 index 00000000000..359d93c5d34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20230509-1.c @@ -0,0 +1,28 @@ +int __attribute__((noipa)) f(unsigned a, int b) +{ + if (a < 0) __builtin_unreachable(); + if (a > 30) __builtin_unreachable(); + int t = a; + if (b) t = 100; + else if (a != 0) + t = a ; + else + t = 1; + return t; +} + + +int main(void) +{ + if (f(0, 0) != 1) + __builtin_abort(); + if (f(1, 0) != 1) + __builtin_abort(); + if (f(0, 1) != 100) + __builtin_abort(); + if (f(1, 0) != 1) + __builtin_abort(); + if (f(30, 0) != 30) + __builtin_abort(); +} +