Skip to content

Compile Warnings [-Wstringop-overread] #14

@sats0k

Description

@sats0k
    inlined from ‘std::string CBase58Data::ToString() const’ at src/base58.h:218:19:
/usr/include/c++/11.1.0/bits/stl_algobase.h:431:30: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
  431 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11.1.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from /usr/include/c++/11.1.0/bits/allocator.h:46,
                 from /usr/include/c++/11.1.0/unordered_map:40,
                 from /usr/include/c++/11.1.0/functional:61,
                 from /usr/include/c++/11.1.0/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11.1.0/algorithm:74,
                 from /usr/include/qt/QtCore/qglobal.h:142,
                 from /usr/include/qt/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt/QtGui/qfont.h:43,
                 from /usr/include/qt/QtGui/QFont:1,
                 from src/qt/addresstablemodel.cpp:1:
/usr/include/c++/11.1.0/ext/new_allocator.h: In member function ‘std::string CBase58Data::ToString() const’:
/usr/include/c++/11.1.0/ext/new_allocator.h:121:48: note: at offset 1 into source object of size 1 allocated by ‘operator new’
  121 |         return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
      |                                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

There are many of this warnings when compiling the wallet.
I made test with -O3 and -Ofast parameters most of the warnings are gone but remaining two more of them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions