Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC maybe-uninitialized failure #6779

Closed
pprkut opened this issue Jul 20, 2024 · 3 comments · Fixed by #6912
Closed

GCC maybe-uninitialized failure #6779

pprkut opened this issue Jul 20, 2024 · 3 comments · Fixed by #6912

Comments

@pprkut
Copy link

pprkut commented Jul 20, 2024

I'm trying to compile binaryen 118 with gcc 14.1.0 and run into this error

[ 30%] Building CXX object third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFDebugAbbrev.cpp.o
cd /usr/src/sbo_tmp/binaryen-version_118/build/third_party/llvm-project && /usr/libexec/icecc/bin/c++  -I/usr/src/sbo_tmp/binaryen-version_118/src -I/usr/src/sbo_tmp/binaryen-version_118/third_party/llvm-project/include -I/usr/src/sbo_tmp/binaryen-version_118/build -O2 -fPIC -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 -w -std=c++14 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -DNDEBUG -UNDEBUG -std=c++17 -MD -MT third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFDebugAbbrev.cpp.o -MF CMakeFiles/llvm_dwarf.dir/DWARFDebugAbbrev.cpp.o.d -o CMakeFiles/llvm_dwarf.dir/DWARFDebugAbbrev.cpp.o -c /usr/src/sbo_tmp/binaryen-version_118/third_party/llvm-project/DWARFDebugAbbrev.cpp
In file included from /usr/src/sbo_tmp/binaryen-version_118/src/parser/wast-parser.cpp:19:
/usr/src/sbo_tmp/binaryen-version_118/src/parser/wat-parser.h: In function ‘wasm::Result<std::vector<wasm::WATParser::ScriptEntry> > wasm::WATParser::{anonymous}::wast(wasm::WATParser::Lexer&)’:
/usr/src/sbo_tmp/binaryen-version_118/src/parser/wat-parser.h:37:8: error: ‘*(wasm::WATParser::InvokeAction*)((char*)&<unnamed> + offsetof(wasm::WATParser::value_type, wasm::WATParser::ScriptEntry::cmd.std::variant<std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::<unnamed>.std::__detail::__variant::_Variant_base<std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::<unnamed>.std::__detail::__variant::_Move_assign_base<false, std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::<unnamed>.std::__detail::__variant::_Copy_assign_base<false, std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::<unnamed>.std::__detail::__variant::_Move_ctor_base<false, std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::<unnamed>.std::__detail::__variant::_Copy_ctor_base<false, std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::<unnamed>.std::__detail::__variant::_Variant_storage<false, std::variant<wasm::WATParser::QuotedModule, std::shared_ptr<wasm::Module> >, wasm::WATParser::Register, std::variant<wasm::WATParser::InvokeAction, wasm::WATParser::GetAction>, std::variant<wasm::WATParser::AssertReturn, wasm::WATParser::AssertAction, wasm::WATParser::AssertModule> >::_M_u)).wasm::WATParser::InvokeAction::name’ may be used uninitialized [-Werror=maybe-uninitialized]
   37 | struct InvokeAction {
      |        ^~~~~~~~~~~~
/usr/src/sbo_tmp/binaryen-version_118/src/parser/wast-parser.cpp:411:21: note: ‘<anonymous>’ declared here
  411 |       cmds.push_back({WASTModule{std::move(wasm)}, line});
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-implicit-int-float-conversion’ may have been intended to silence earlier diagnostics
cc1plus: all warnings being treated as errors
make[2]: *** [src/parser/CMakeFiles/parser.dir/build.make:188: src/parser/CMakeFiles/parser.dir/wast-parser.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

-Wno-maybe-uninitialized helps to work around it

@kripken
Copy link
Member

kripken commented Jul 24, 2024

@tlively you know that code best - any ideas?

@tlively
Copy link
Member

tlively commented Jul 24, 2024

Looks like another false positive we could work around with a pragma. Maybe we should just consider turning off this warning globally?

@kripken
Copy link
Member

kripken commented Jul 25, 2024

I think this warning is sometimes helpful, so I'd lean towards finding a reasonable workaround in the code, or using a pragma.

smoser added a commit to smoser/binaryen that referenced this issue Sep 6, 2024
This probably isn't the ideal solution but it did allow me
to get binaryen building with gcc 14.2.

Fixes: WebAssembly#6779
@kripken kripken closed this as completed in 0b07c1b Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants