From patchwork Tue Feb 21 12:00:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 59971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1827670wrn; Tue, 21 Feb 2023 04:14:36 -0800 (PST) X-Google-Smtp-Source: AK7set9qUX57KEbsjyyB0feEV3PFlV4ZfJzeCa6ppXAuSOR+iOXQ4Ta3ZxBzv7CL0ZNTMc36a2KU X-Received: by 2002:a17:906:57c6:b0:8b1:fc1a:7d19 with SMTP id u6-20020a17090657c600b008b1fc1a7d19mr14385862ejr.3.1676981676638; Tue, 21 Feb 2023 04:14:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676981676; cv=none; d=google.com; s=arc-20160816; b=Ax2ROCHyp7KaM81U59yPD7cVprQDdCZSPoyvpb0HhiS6ydOSuFPAR7h3oo+4tTaBrv XWO8t0s1Xd3vWgoiLhdEyZ9dDcX1E+3yZy8RbPWUAlQBdNAoIBfP8djv9rRwUDeWechJ A+KMMHGMm5Rc6STxQccpPIyF0KzUYYtZV34W41Z734Jw9R1PE4e4TMV6cXnGheBcQyRM alJj0Vmw0iVKxZodkL8fo301IlfE8ZEd3ZY3AgjBbiPQCnVcjMEfAYTX+8FnhrfKUn6N aOsP5x0ybQQd29Q6bwxP0rC0ytVYokPb/ndXcmXgwVrbQ5XJ2ZJ2OhXcVsZw/Hsa3Exx ggUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=dkZNfYo5adB+2p9cQ/FuEDLBDNUVW7F9W4GLQmDwl0s=; b=NyXggzF5IVDIpmCcD5nCiRiXNF5QnAnpy+nMtRYu2hi609e6EPBfuNrGW1EOrkHGHk iU/uJhhDMmgb8x2spW0m+lT46E5Mn1Ld0WiXFLVG/P5XGv56t+Gc8KfO1s8UMQc7Z12d 985kmF0Ef4kimAT9dWgSckDJe+s89GswAmQNHSjJUUddaluTF2OzW5lMiD8mKxbQhRCV TIuck3L7dlTI1S0HEUIxq4m/82G3VTP+yP9Mz1qvD81Gl+ihGWNm50eeb+UDVR8juwW3 qFXRFKgEu13hXPQZLzx5OQvrjqXlV1cUpODHcNpTXb9C2UHe0Y2OTm2w7ExTCs9e0Vlz IC8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=JzF7NeEc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 21-20020a170906009500b0088c5e867083si23945830ejc.807.2023.02.21.04.14.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:14:36 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=JzF7NeEc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78AB5395A466 for ; Tue, 21 Feb 2023 12:07:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 3059E3851AB8 for ; Tue, 21 Feb 2023 12:03:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3059E3851AB8 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x430.google.com with SMTP id t13so4087804wrv.13 for ; Tue, 21 Feb 2023 04:03:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=dkZNfYo5adB+2p9cQ/FuEDLBDNUVW7F9W4GLQmDwl0s=; b=JzF7NeEccF0w2fIZwF9fzuyZPcXY3OThG5r2rKrIudNFpxWdC81CMMhi0NGB39Wzbo cQ6baAzuESmp+m4x4Krj1dZhs0WhhFeBagdro0/DHoLaME93Tc9J9lIesDgW516GBT3w jNs0EMY+tNTryK+FkQvSkUgSzLQUceUGXMVH6wS7UtX8+03L1aK1rfa06YsJ9k7OQOGR U9qzboofwz/tu1c0ZNYwhPOI/hZqt1TMi6djnlXdK6ZQUUsmOjP/7Z2rKjyqF0IUSx8b L9rTsfGBKQfkAOoabG7xckj94KzDn4W//eXimBxUpjQAoGwa3wVxydRUXP+agLpXyywE e/mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dkZNfYo5adB+2p9cQ/FuEDLBDNUVW7F9W4GLQmDwl0s=; b=Im83JRFKmGoD2ATUSEUOWRx+LKU8DhTOj7ESQgXrKeIoyZg8z+kWemM5rRMOsr6q9n NBFirJs6i1kgCIiN9aXJD+4JILJtGQH8z2x8bd8wJ2eC4t8qR1cbAYjOkuAnjaVesvG9 VNy222tiw7BqRNOntsD7EZ8Lab32YX829G/pehz3VYjqRKgc/tJ/1TYDhI/xKC69IKBs SvAFhUQSQPW12G/NP1fV6FbxPk0q7KQLQPKXjmSG7Fq8vz8LHttoyc/wzctH6wtKuiKs FWsJT4V03fhjN/CATweLYE3iCJimJlIYi7Pj1l3Vt+oTL58QbdWKNq2Di8gn4Jc/rnDV +87A== X-Gm-Message-State: AO0yUKW03y9X9bAS6JFvqglP5CloGnWCvRaFStngefO/+ewBB5tpBV0p HCLtu7gGNhP2yLPXftxIvt3Dk/llb5TmWB6KUw== X-Received: by 2002:a5d:49c1:0:b0:2c5:5ca4:ef14 with SMTP id t1-20020a5d49c1000000b002c55ca4ef14mr3278998wrs.9.1676981008741; Tue, 21 Feb 2023 04:03:28 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id c15-20020adffb4f000000b002c55b0e6ef1sm5013811wrs.4.2023.02.21.04.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:03:27 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Faisal Abbas , Faisal Abbas <90.abbasfaisal@gmail.com> Subject: [committed 005/103] gccrs: testing: try loop in const function Date: Tue, 21 Feb 2023 13:00:55 +0100 Message-Id: <20230221120230.596966-6-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221120230.596966-1-arthur.cohen@embecosm.com> References: <20230221120230.596966-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable 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: , Reply-To: arthur.cohen@embecosm.com 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?1758442738785378692?= X-GMAIL-MSGID: =?utf-8?q?1758442738785378692?= From: Faisal Abbas Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com> gcc/testsuite/ChangeLog: * rust/compile/const9.rs: New test. Signed-off-by: Faisal Abbas --- gcc/testsuite/rust/compile/const9.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/rust/compile/const9.rs diff --git a/gcc/testsuite/rust/compile/const9.rs b/gcc/testsuite/rust/compile/const9.rs new file mode 100644 index 00000000000..e71a62a33b1 --- /dev/null +++ b/gcc/testsuite/rust/compile/const9.rs @@ -0,0 +1,18 @@ +// { dg-options "-w -O0 -fdump-tree-gimple" } +const fn test(mut x: i32) -> i32 { + loop { + if x == 10 { + break; + } + + x = x + 1; + } + return x; +} + +const X: i32 = test(0); + +fn main() { + // { dg-final { scan-tree-dump-times {x = 10} 1 gimple } } + let x = X; +}