gnu/gcc/d9de08d4cf6e8cb940015656da5a30ccbdb895b5 gccrs: constructors that get borrowed need to be addressable
When we have const expr dealing with slices we end up taking a pointer of
an array as the data pointer. This is a cosntructor expr ususally but const
eval expects these to be addressable objects like tmps holding onto the data
but we get away with this in regular compilation because gcc optimizes it.
Fixes Rust-GCC/gccrs#4867
Fixes Rust-GCC/gccrs#4868
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): make addressable
* backend/rust-constexpr.cc (eval_store_expression): port over missing cp/constexpr.cc
gcc/testsuite/ChangeLog:
* rust/compile/issue-4867.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
3 files changed