aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-05-23 12:05:13 +0200
committerMark Wielaard <mark@klomp.org>2021-05-23 12:05:13 +0200
commit9ca4faebe11908f3c634a36cd95db002152c3057 (patch)
treeee056c1d026cf87272e7dca83d2a6a65e5f791e8
parent99b73780e6e30f962c01532d3ec189ceeecf7f93 (diff)
downloadgcc-9ca4faebe11908f3c634a36cd95db002152c3057.zip
gcc-9ca4faebe11908f3c634a36cd95db002152c3057.tar.gz
gcc-9ca4faebe11908f3c634a36cd95db002152c3057.tar.bz2
Initialize crateNumItr in rust-hir-map to zero.
valgrind complains whenever a crate number is used because they are all derived from the initial crateNumItr in the rust-hir-map Mapping which is never initialized. This isn't technically a bug because all that is required is for crate numbers to be unique. But it could cause non-deterministic behaviour when crate numbers are used for sorting. And it makes the valgrind output really noisy. With this patch and configure --enable-valgrind-annotations running rust1 should not give any valgrind errors.
-rw-r--r--gcc/rust/util/rust-hir-map.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index a198be6..9feff33 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -198,7 +198,7 @@ public:
private:
Mappings ();
- CrateNum crateNumItr;
+ CrateNum crateNumItr = 0;
CrateNum currentCrateNum;
std::map<CrateNum, HirId> hirIdIter;