diff options
author | Alon Zakai <azakai@google.com> | 2024-10-28 13:34:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-28 13:34:09 -0700 |
commit | e3eaeef991445db2e6af782e202d67585398a43f (patch) | |
tree | b8f8f0c2a21709c2c404b6bf426d6326d5f679d0 /src/support/small_vector.h | |
parent | 690576cda63d59ae0cfc3906e1146a7a4278db43 (diff) | |
download | binaryen-e3eaeef991445db2e6af782e202d67585398a43f.tar.gz binaryen-e3eaeef991445db2e6af782e202d67585398a43f.tar.bz2 binaryen-e3eaeef991445db2e6af782e202d67585398a43f.zip |
Fix Apline compile error on uninitialized value (#7035)
Similar to
* https://github.com/WebAssembly/binaryen/pull/6330
* https://github.com/WebAssembly/binaryen/issues/6311
* https://github.com/WebAssembly/binaryen/pull/6912
* https://github.com/WebAssembly/binaryen/issues/5946
This extends the region we ignore the gcc warning in.
The warning:
ninja: job failed: /usr/bin/c++ -I/src/src -I/src/third_party/FP16/include -I/src/third_party/llvm-project/include -I/src -static -DBUILD_LLVM_DWARF -Wall -Werror -Wextra -Wno-unused-parameter -Wno-dangling-pointer -fno-omit-frame-pointer -fno-rtti -Wno-implicit-int-float-conversion -Wno-unknown-warning-option -Wswitch -Wimplicit-fallthrough -Wnon-virtual-dtor -fPIC -fdiagnostics-color=always -O3 -DNDEBUG -UNDEBUG -std=c++17 -MD -MT src/passes/CMakeFiles/passes.dir/Precompute.cpp.o -MF src/passes/CMakeFiles/passes.dir/Precompute.cpp.o.d -o src/passes/CMakeFiles/passes.dir/Precompute.cpp.o -c /src/src/passes/Precompute.cpp
In file included from /src/src/literal.h:27,
from /src/src/wasm.h:36,
from /src/src/ir/boolean.h:20,
from /src/src/ir/bits.h:20,
from /src/src/ir/properties.h:20,
from /src/src/ir/iteration.h:20,
from /src/src/passes/Precompute.cpp:30:
In copy constructor 'wasm::SmallVector<T, N>::SmallVector(const wasm::SmallVector<T, N>&) [with T = wasm::Expression*; long unsigned int N = 10]',
inlined from 'constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 = wasm::Select* const; _U2 = wasm::SmallVector<wasm::Expression*, 10>; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true; _T1 = wasm::Select* const; _T2 = wasm::SmallVector<wasm::Expression*, 10>]' at /usr/include/c++/13.2.1/bits/stl_pair.h:559:21,
inlined from 'T& wasm::InsertOrderedMap<Key, T>::operator[](const Key&) [with Key = wasm::Select*; T = wasm::SmallVector<wasm::Expression*, 10>]' at /src/src/support/insert_ordered.h:112:29,
inlined from 'void wasm::Precompute::partiallyPrecompute(wasm::Function*)::StackFinder::visitSelect(wasm::Select*)' at /src/src/passes/Precompute.cpp:571:24,
inlined from 'static void wasm::Walker<SubType, VisitorType>::doVisitSelect(SubType*, wasm::Expression**) [with SubType = wasm::Precompute::partiallyPrecompute(wasm::Function*)::StackFinder; VisitorType = wasm::Visitor<wasm::Precompute::partiallyPrecompute(wasm::Function*)::StackFinder, void>]' at /src/src/wasm-delegations.def:50:1:
/src/src/support/small_vector.h:69:35: error: '<unnamed>.wasm::SmallVector<wasm::Expression*, 10>::fixed' may be used uninitialized [-Werror=maybe-uninitialized]
69 | : usedFixed(other.usedFixed), fixed(other.fixed), flexible(other.flexible) {
| ^~~~~~~~~~~~~~~~~~
In file included from /src/src/passes/Precompute.cpp:37:
/src/src/support/insert_ordered.h: In static member function 'static void wasm::Walker<SubType, VisitorType>::doVisitSelect(SubType*, wasm::Expression**) [with SubType = wasm::Precompute::partiallyPrecompute(wasm::Function*)::StackFinder; VisitorType = wasm::Visitor<wasm::Precompute::partiallyPrecompute(wasm::Function*)::StackFinder, void>]':
/src/src/support/insert_ordered.h:112:29: note: '<anonymous>' declared here
112 | std::pair<const Key, T> kv = {k, {}};
| ^~
Diffstat (limited to 'src/support/small_vector.h')
-rw-r--r-- | src/support/small_vector.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/support/small_vector.h b/src/support/small_vector.h index dd0370554..efd866cb5 100644 --- a/src/support/small_vector.h +++ b/src/support/small_vector.h @@ -53,14 +53,6 @@ template<typename T, size_t N> class SmallVector { // flexible additional storage std::vector<T> flexible; -#if defined(__aarch64__) -#pragma GCC diagnostic pop -#endif - -#if defined(__riscv) && __riscv_xlen == 64 -#pragma GCC diagnostic pop -#endif - public: using value_type = T; @@ -286,6 +278,14 @@ struct ZeroInitSmallVector : public SmallVector<T, N> { } }; +#if defined(__aarch64__) +#pragma GCC diagnostic pop +#endif + +#if defined(__riscv) && __riscv_xlen == 64 +#pragma GCC diagnostic pop +#endif + } // namespace wasm #endif // wasm_support_small_vector_h |