From patchwork Tue Jan 31 13:25: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: 63993 Return-Path: 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 B03C83AA9439 for ; Tue, 31 Jan 2023 13:24:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id F32923952536 for ; Tue, 31 Jan 2023 13:22:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F32923952536 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-x429.google.com with SMTP id bk16so14171111wrb.11 for ; Tue, 31 Jan 2023 05:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r3bYY8bWihA3BUp7kBIPybjcWQhkCJGQ3qcbJansVYQ=; b=MQTd/PTjzjTqaTzTDrPK6a7r8Tesw/j5M41UO6WcLXE+uB9ujynbuForGqM2eO7FEn E2nPBXgn04HlIFzAzuCiqwnAGXqV70OjaEsfriQvhs1tozX74NhWXlDxYEg3youzVwaZ nPky2LVdwo40ke9ju5rgvkQcR9zzzf4WSDGpsYMaqTgsh6kDOC4IChn4H4OnWNx8i62z /I9VFkiTpIdB6dDRBlH8ycT62vg4v6pmdnZp8KAViQR08786dG4k5a2g4UuJS2uzucMW jk9RuwgWGIgEfo6hqTxq62+VEASMnmaYnX7VIE3L2D/0rPyIiVxUepmxE/wFM6dAqHNU +EZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r3bYY8bWihA3BUp7kBIPybjcWQhkCJGQ3qcbJansVYQ=; b=ZivsoEiMNNaAujepv3UbXLDDabCQhuI4I7QBVZSNBmQNTnRspOpsY+yng4GdB8Rz0b OBdIM9jW2oQ7mbSTj7uS4HjbMZxhWIiCOjTXgiv3w7jozeusSmpZxNcEihLhZhdrbaJT J3MIZ+4IjkJkaAWGis2jjK4e/lsUtB+SHqOCVUqMWTzkqCXJfkN3/gGICWNYH7WekO4t nAvZUDVSx2pcV91ZKb+RGfjK3/UP4u4K/ZPx6Dk6RKm9CVkxtOGPNGfKAdTXhO0/Ibdn lUPPX3GNpAgYkxDzBIShjGdFZ/hXa0tlWRn5m/EPRza2fOvgs0WIORIOFYOmD5lCRVIQ UkFA== X-Gm-Message-State: AO0yUKVgoYDa8q3T3Gk0Z5G1gRncS2H5SlVG0ePiYMKmWdRiqJNyPnu2 bYPZyPXeOIKuuQsxrj+BTQ7CQLdykcgGMCP3YA== X-Google-Smtp-Source: AK7set9463mMsYxAztQ3c6wx2FE+/62h6RV+RsAsXwiXnPA8yrtkzNaDq2B1pf3DZ4ENPn6MLFm7pw== X-Received: by 2002:adf:a50f:0:b0:2bf:bf36:1604 with SMTP id i15-20020adfa50f000000b002bfbf361604mr21023097wrb.35.1675171331330; Tue, 31 Jan 2023 05:22:11 -0800 (PST) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.gmail.com with ESMTPSA id r28-20020adfa15c000000b002bfd137ecddsm12793056wrr.11.2023.01.31.05.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 05:22:11 -0800 (PST) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Faisal Abbas <90.abbasfaisal@gmail.com> Subject: [COMMITTED] gccrs: add testcase to test component_ref and constructor codes in eval_constant_expression() Date: Tue, 31 Jan 2023 14:25:55 +0100 Message-Id: <20230131132555.662678-1-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-15.5 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 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Faisal Abbas <90.abbasfaisal@gmail.com> gcc/testsuite/ChangeLog: * rust/compile/const7.rs: New test. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com> Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/testsuite/rust/compile/const7.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/rust/compile/const7.rs diff --git a/gcc/testsuite/rust/compile/const7.rs b/gcc/testsuite/rust/compile/const7.rs new file mode 100644 index 00000000000..a7431c0c4d2 --- /dev/null +++ b/gcc/testsuite/rust/compile/const7.rs @@ -0,0 +1,12 @@ +// { dg-options "-w -O0 -fdump-tree-gimple" } +struct Foo(usize, usize); + +const A:Foo = Foo(123, 4546); + +const B:usize = A.0; + +fn main() { + // { dg-final { scan-tree-dump-times {b = 123} 1 gimple } } + let b = B; +} +