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

Tons of uninitialized memory access bugs #199

Open
clbr opened this issue Oct 27, 2020 · 9 comments
Open

Tons of uninitialized memory access bugs #199

clbr opened this issue Oct 27, 2020 · 9 comments

Comments

@clbr
Copy link

clbr commented Oct 27, 2020

I was getting corrupted output randomly, and decided to run armips under valgrind. It blew up in over 20 places:

==2141== Memcheck, a memory error detector
==2141== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2141== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2141== Command: armips -root rspasm -sym getbitmap.sym getbitmap.s
==2141== Parent PID: 2064
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x446B21: CAssemblerLabel::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x42E852: MipsMacroCommand::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x449A55: CDirectiveArea::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462D13: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x446B21: CAssemblerLabel::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x449A55: CDirectiveArea::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462D13: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x446B21: CAssemblerLabel::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x449A55: CDirectiveArea::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462D13: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x44AE93: CDirectiveConditional::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x42E852: MipsMacroCommand::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x449A55: CDirectiveArea::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462D13: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x466F82: ExpressionValue::operator||(ExpressionValue const&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46B36E: ExpressionInternal::evaluate() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x44ADC9: CDirectiveConditional::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x44AE5E: CDirectiveConditional::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x42E852: MipsMacroCommand::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x449A55: CDirectiveArea::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462D13: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x4271B8: CMipsInstruction::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x44AE5E: CDirectiveConditional::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x44AE5E: CDirectiveConditional::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x42E852: MipsMacroCommand::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x449A55: CDirectiveArea::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x454933: CommandSequence::Validate(ValidateState const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462D13: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x462D43: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Thread 3:
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x447529: CAssemblerLabel::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548E7: CommandSequence::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x447E9D: CDirectiveArea::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548E7: CommandSequence::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462234: _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZ14encodeAssemblySt10unique_ptrI17CAssemblerCommandSt14default_deleteIS4_EER10SymbolDataR8TempDataEUlvE0_EEEEE6_M_runEv (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x494D65: SymbolData::addLabel(long, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4476A0: CAssemblerLabel::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548E7: CommandSequence::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x447E9D: CDirectiveArea::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548E7: CommandSequence::writeSymData(SymbolData&) const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462234: _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZ14encodeAssemblySt10unique_ptrI17CAssemblerCommandSt14default_deleteIS4_EER10SymbolDataR8TempDataEUlvE0_EEEEE6_M_runEv (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x49057E: void std::__introsort_loop<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A48: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x49058D: void std::__introsort_loop<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A48: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x4909C3: void std::__introsort_loop<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A48: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x4909A8: void std::__introsort_loop<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A48: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x490A0D: void std::__introsort_loop<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A48: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x490A1C: void std::__introsort_loop<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, long, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A48: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x48FA9A: void std::__insertion_sort<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A68: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x48F838: void std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Val_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Val_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x48FD2E: void std::__insertion_sort<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A68: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x48F7D8: void std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Val_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Val_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x48FD2E: void std::__insertion_sort<__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__normal_iterator<NocashSymEntry*, std::vector<NocashSymEntry, std::allocator<NocashSymEntry> > >, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.0] (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492A68: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Thread 1:
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x44ACD4: CDirectiveConditional::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548A4: CommandSequence::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548A4: CommandSequence::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x447D73: CDirectiveArea::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548A4: CommandSequence::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462E19: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Syscall param write(buf) points to uninitialised byte(s)
==2141==    at 0x56BDF6B: ??? (in /lib/libpthread-2.7.so)
==2141==    by 0x4EFB9F5: std::__basic_file<char>::xsputn(char const*, long) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F41BC0: std::basic_filebuf<char, std::char_traits<char> >::_M_convert_to_external(char*, long) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F41FD2: std::basic_filebuf<char, std::char_traits<char> >::overflow(int) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F41D22: std::basic_filebuf<char, std::char_traits<char> >::_M_terminate_output() (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F45196: std::basic_filebuf<char, std::char_traits<char> >::close() (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x489D8B: FileManager::closeFile() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548A4: CommandSequence::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462E19: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==  Address 0x5f2cfae is 14 bytes inside a block of size 8,192 alloc'd
==2141==    at 0x4C23414: operator new[](unsigned long) (in /opt/valgrind/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2141==    by 0x4F41A73: std::basic_filebuf<char, std::char_traits<char> >::_M_allocate_internal_buffer() (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F45E3F: std::basic_filebuf<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x48B710: GenericAssemblerFile::open(bool) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x451490: CDirectiveFile::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4548A4: CommandSequence::Encode() const (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x462E19: encodeAssembly(std::unique_ptr<CAssemblerCommand, std::default_delete<CAssemblerCommand> >, SymbolData&, TempData&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x46387E: runArmips(ArmipsArguments&) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C3767: runFromCommandLine(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, ArmipsArguments) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4C4E8F: wmain(int, wchar_t**) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x415FAA: main (in /tiedostot/mv/c/armips/armips)
==2141== 
==2141== Thread 3:
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x4F88470: std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > std::num_put<wchar_t, std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > >::_M_insert_int<long>(std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, std::ios_base&, wchar_t, long) const (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F6C863: std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::_M_insert<long>(long) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x419DDF: tinyformat::detail::formatImpl(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >&, wchar_t const*, tinyformat::detail::FormatArg const*, int) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492CCD: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Use of uninitialised value of size 8
==2141==    at 0x4F883B1: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F88499: std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > std::num_put<wchar_t, std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > >::_M_insert_int<long>(std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, std::ios_base&, wchar_t, long) const (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F6C863: std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::_M_insert<long>(long) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x419DDF: tinyformat::detail::formatImpl(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >&, wchar_t const*, tinyformat::detail::FormatArg const*, int) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492CCD: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== Conditional jump or move depends on uninitialised value(s)
==2141==    at 0x4F883B7: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F88499: std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > std::num_put<wchar_t, std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > >::_M_insert_int<long>(std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, std::ios_base&, wchar_t, long) const (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x4F6C863: std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::_M_insert<long>(long) (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x419DDF: tinyformat::detail::formatImpl(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >&, wchar_t const*, tinyformat::detail::FormatArg const*, int) (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x492CCD: SymbolData::writeNocashSym() (in /tiedostot/mv/c/armips/armips)
==2141==    by 0x4F09AA6: ??? (in /tiedostot/mv/gcc102/lib64/libstdc++.so.6.0.28)
==2141==    by 0x56B6FEA: start_thread (in /lib/libpthread-2.7.so)
==2141==    by 0x598F94C: clone (in /lib/libc-2.7.so)
==2141== 
==2141== 
==2141== HEAP SUMMARY:
==2141==     in use at exit: 72,704 bytes in 1 blocks
==2141==   total heap usage: 14,536 allocs, 14,535 frees, 2,315,474 bytes allocated
==2141== 
==2141== LEAK SUMMARY:
==2141==    definitely lost: 0 bytes in 0 blocks
==2141==    indirectly lost: 0 bytes in 0 blocks
==2141==      possibly lost: 0 bytes in 0 blocks
==2141==    still reachable: 72,704 bytes in 1 blocks
==2141==         suppressed: 0 bytes in 0 blocks
==2141== Rerun with --leak-check=full to see details of leaked memory
==2141== 
==2141== For counts of detected and suppressed errors, rerun with: -v
==2141== Use --track-origins=yes to see where uninitialised values come from
==2141== ERROR SUMMARY: 95 errors from 23 contexts (suppressed: 5 from 5)
@clbr
Copy link
Author

clbr commented Oct 27, 2020

When built with -g -fno-inline to get more accurate logs, it straight up segfaults.

==2694== Command: armips -root rspasm -sym getbitmap.sym getbitmap.s
==2694== Parent PID: 2064
==2694==
==2694==
==2694== Process terminating with default action of signal 11 (SIGSEGV)
==2694==  Bad permissions for mapped region at address 0x72FB48
==2694==    at 0x72FB48: ??? (in /tiedostot/mv/c/armips/armips)
==2694==    by 0x412835: tinyformat::detail::formatImpl(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >&, wchar_t const*, tinyformat::detail::FormatArg const*, int) (tinyformat.h:815)
==2694==    by 0x4134C4: _ZN10tinyformat6formatIJmEEENSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEEPKwDpRKT_ (in /tiedostot/mv/c/armips/armips)
==2694==    by 0x47D537: _ZN11SymbolTable18getUniqueLabelNameB5cxx11Eb (SymbolTable.cpp:172)
==2694==    by 0x423D45: _Z15preprocessMacroB5cxx11PKwR17MipsImmediateData (MipsMacros.cpp:58)
==2694==    by 0x4245B9: generateMipsMacroLoadStore(Parser&, MipsRegisterData&, MipsImmediateData&, int) (MipsMacros.cpp:215)
==2694==    by 0x42851E: MipsParser::parseMacro(Parser&) (MipsParser.cpp:1578)
==2694==    by 0x41F45A: CMipsArchitecture::parseOpcode(Parser&) (Mips.cpp:29)
==2694==    by 0x48AF4F: Parser::parseCommand() (Parser.cpp:728)
==2694==    by 0x48A192: Parser::parseCommandSequence(wchar_t, std::initializer_list<wchar_t const*>) (Parser.cpp:144)
==2694==    by 0x481217: parseDirectiveArea(Parser&, int) (DirectivesParser.cpp:459)
==2694==    by 0x48988E: Parser::parseDirective(std::unordered_multimap<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, DirectiveEntry const, std::hash<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::equal_to<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, DirectiveEntry const> > > const&) (Parser.cpp:242)

@Kingcom
Copy link
Owner

Kingcom commented Oct 27, 2020

Can you provide an example file that produces this problem?

@clbr
Copy link
Author

clbr commented Oct 27, 2020

You mean it doesn't blow up for you? That many locations should effect other targets than just rsp.

Sec, will grab a test file.

@clbr
Copy link
Author

clbr commented Oct 27, 2020

Seeing if github upload works.

@clbr
Copy link
Author

clbr commented Oct 27, 2020

Nope, doesn't work. Uploaded to https://anonymousfiles.io/m1Rl3kid/

@Kingcom
Copy link
Owner

Kingcom commented Oct 27, 2020

I've had no issues with it on Windows with VS 2017 using both debug and release configurations. On Ubuntu 20.04 with GCC 9 it also ran fine, though Valgrind showed some of the same uninitialized value warnings. ASan had no complaints though.

What are your build settings?

@clbr
Copy link
Author

clbr commented Oct 27, 2020

gcc 10.2, -O3 -march=nocona -mtune=k8 -fomit-frame-pointer

@Kingcom
Copy link
Owner

Kingcom commented Oct 27, 2020

Okay, I could reproduce the crash with GCC 9 as well when using -O3 and -fno-inline (Clang 10 works). It seems to crash whenever tinyformat is used at all. Not sure what would cause it though...

@clbr
Copy link
Author

clbr commented Oct 28, 2020

There seem to be newer tinyformat versions, but it appears the copy here is modified to be wchar. It could also be a bug in tinyformat, even the new versions, of course.

Just a note, asan catches a small fraction of the stuff valgrind does, I believe even their own docs say so. It's meant to be fast, not complete.

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

No branches or pull requests

2 participants