From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id DBCF0384DD02 for ; Tue, 21 Feb 2023 12:03:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DBCF0384DD02 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-x434.google.com with SMTP id l25so3756712wrb.3 for ; Tue, 21 Feb 2023 04:03:29 -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=k7APUzlhV+zt809gtNAwyetA7pRfBvsQJTNVV/3rXp5YEKWFWwYF4Qh00++mMWS3pN OYrtSI9iydMJ+/t1NqTPx0dNOrTCq1sqzyoeXojiSiPoEQLOMUvxfZbHdBibxTynRjlb Y1De2/RSy1HKzUqw7XMKmTxuYdvPBL83vherpP+tJLjawZQS6b3PUOU4N3GrMVVvxllV oW/fAjqp3gSenoZWptC4FbqNCBhDEtS2coISKenUhSUwb0sjPywJJRd/ERU4l9jy+OSU VecPwoYmCRbLwKRcywegkwkvSW9K/I3wXJaIyO2Q4WIyMTCzI/eG65tJoaEsVzjOYqI7 oq0Q== X-Gm-Message-State: AO0yUKXm6vdz1C3mWDDC6Qh9ZcP66vvo/Dzrm7LUE1WUxVy9waj5vrJ7 Ab+bi8pUGGfzayuSXQZzbZm9 X-Google-Smtp-Source: AK7set8LlSQPKl/FVaFbgskB0pZRsz464tF9PmXIykNrDjO6I8DrTPjSnEXjw6uus+/Tfr0EPaZS0w== 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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.8 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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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; +} -- 2.39.1