]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix ICE using constructors for intilizers in statics
authorPhilip Herron <herron.philip@googlemail.com>
Sun, 2 Apr 2023 20:59:50 +0000 (21:59 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:28:43 +0000 (18:28 +0100)
commit072d8e660bbd0996f5b2ff3567a45c9876986052
tree4f17eb92cb77687f38b99af0c3902533067ea87e
parent8bc2a3e40e86a6a125c985f05616537c130cb2cb
gccrs: Fix ICE using constructors for intilizers in statics

We are getting constant expressions for the initilizers for static items
this hits an assertion in the GCC middle-end which is looking for a
constructor so we need to unwrap the constant expression using DECL_INITIAL
as the initilizer to the global static.

Fixes #2080

gcc/rust/ChangeLog:

* backend/rust-compile-item.cc (CompileItem::visit): unwrap the constant expression

gcc/testsuite/ChangeLog:

* rust/execute/torture/issue-2080.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/backend/rust-compile-item.cc
gcc/testsuite/rust/execute/torture/issue-2080.rs [new file with mode: 0644]