Skip to content

GCC maybe-uninitialized failure #6779

Closed

Description

@pprkut

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

Activity

  1. kripken commented on Jul 24, 2024

    @kripken
    Member

    @tlively you know that code best - any ideas?

  2. tlively commented on Jul 24, 2024

    @tlively
    Member

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

  3. kripken commented on Jul 25, 2024

    @kripken
    Member

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

  4. added a commit that references this issue on Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions