aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-04-02 21:48:33 +0200
committerPhilip Herron <herron.philip@googlemail.com>2021-04-05 10:54:13 +0100
commit21522a81416d88704ef009a82eb95a7b7ff62cc3 (patch)
tree1f3443c01096b33db39d761cb9e226f4c41783c0
parentf0ad7aefdc64e7b770aed5e2cce7bd9bacbd4610 (diff)
downloadgcc-21522a81416d88704ef009a82eb95a7b7ff62cc3.zip
gcc-21522a81416d88704ef009a82eb95a7b7ff62cc3.tar.gz
gcc-21522a81416d88704ef009a82eb95a7b7ff62cc3.tar.bz2
Address 'error: ‘*<unknown>.Rust::HIR::ArrayType::<anonymous>.Rust::HIR::TypeNoBounds::<anonymous>.Rust::HIR::Type::mappings’ is used uninitialized [-Werror=uninitialized]' diagnostic [#336]
... by doing the same as in the "assignment operator to deep copy pointers" a few lines later. I have not verified what's (supposed to be) going on here; that code seems unused, and thus untested, and thus I marked it up as such. In file included from [...]/gcc/rust/hir/tree/rust-hir-full.h:29, from [...]/gcc/rust/backend/rust-compile.h:23, from [...]/gcc/rust/backend/rust-compile.cc:19: [...]/gcc/rust/hir/tree/rust-hir-type.h: In copy constructor ‘Rust::HIR::ArrayType::ArrayType(const Rust::HIR::ArrayType&)’: [...]/gcc/rust/hir/tree/rust-hir-type.h:607:21: error: ‘*<unknown>.Rust::HIR::ArrayType::<anonymous>.Rust::HIR::TypeNoBounds::<anonymous>.Rust::HIR::Type::mappings’ is used uninitialized [-Werror=uninitialized] 607 | : TypeNoBounds (mappings), elem_type (other.elem_type->clone_type ()), | ^~~~~~~~
-rw-r--r--gcc/rust/hir/tree/rust-hir-type.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-type.h b/gcc/rust/hir/tree/rust-hir-type.h
index 47850ae..42fccb5 100644
--- a/gcc/rust/hir/tree/rust-hir-type.h
+++ b/gcc/rust/hir/tree/rust-hir-type.h
@@ -604,9 +604,12 @@ public:
// Copy constructor requires deep copies of both unique pointers
ArrayType (ArrayType const &other)
- : TypeNoBounds (mappings), elem_type (other.elem_type->clone_type ()),
+ : TypeNoBounds (other.mappings), elem_type (other.elem_type->clone_type ()),
size (other.size->clone_expr ()), locus (other.locus)
- {}
+ {
+ // Untested.
+ gcc_unreachable ();
+ }
// Overload assignment operator to deep copy pointers
ArrayType &operator= (ArrayType const &other)