Skip to content

Commit 3ff3762

Browse files
Fix uninitialized member (#8094)
std::array is an aggregate type with a C array as a member so its default initialization is garbage. Change it to value initialization to ensure that it has a defined value which removes the need for disabling the warnings and fixes the Alpine CI build.
1 parent 70bf2dc commit 3ff3762

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/support/small_vector.h

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,10 @@
3030

3131
namespace wasm {
3232

33-
// We don't understand this warning, only here and only on aarch64 and riscv64,
34-
// we suspect it's spurious so disabling for now.
35-
//
36-
// For context: https://github.com/WebAssembly/binaryen/issues/6311
37-
38-
#if defined(__aarch64__)
39-
#pragma GCC diagnostic push
40-
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
41-
#endif
42-
43-
// https://github.com/WebAssembly/binaryen/issues/6410
44-
#if defined(__riscv) && __riscv_xlen == 64
45-
#pragma GCC diagnostic push
46-
#pragma GCC diagnostic ignored "-Wuninitialized"
47-
#endif
48-
4933
template<typename T, size_t N> class SmallVector {
5034
// fixed-space storage
5135
size_t usedFixed = 0;
52-
std::array<T, N> fixed;
36+
std::array<T, N> fixed{};
5337

5438
// flexible additional storage
5539
std::vector<T> flexible;
@@ -246,14 +230,6 @@ struct ZeroInitSmallVector : public SmallVector<T, N> {
246230
}
247231
};
248232

249-
#if defined(__aarch64__)
250-
#pragma GCC diagnostic pop
251-
#endif
252-
253-
#if defined(__riscv) && __riscv_xlen == 64
254-
#pragma GCC diagnostic pop
255-
#endif
256-
257233
} // namespace wasm
258234

259235
#endif // wasm_support_small_vector_h

0 commit comments

Comments
 (0)