]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix bad uninit intrinsic
authorPhilip Herron <herron.philip@googlemail.com>
Mon, 28 Aug 2023 13:20:04 +0000 (14:20 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:00:34 +0000 (19:00 +0100)
commitad1c244dd607fd7607ef95eecc2718e98578a70c
treec4298be092da264079443dbe5a811ee3339a0060
parent11963393d073a4e54d2e25fccac2962cb66b2dd3
gccrs: Fix bad uninit intrinsic

We were using the DECL_RESULT but this just contains the TREE_TYPE of the
retval. It was also missing taking the address of the destination for the
memset call. This changes the code to create a temp variable for the return
value and asserts the destination size is the same as the size of the
template param.

Fixes #2583

gcc/rust/ChangeLog:

* backend/rust-compile-intrinsic.cc (enter_intrinsic_block): take the locals vector
(uninit_handler): make a temp variable and use the address of it

gcc/testsuite/ChangeLog:

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

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