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

stringop-overflow warning compiling with MingGW GCC 14.1.0 #25

Open
rjollos opened this issue Jan 31, 2025 · 0 comments
Open

stringop-overflow warning compiling with MingGW GCC 14.1.0 #25

rjollos opened this issue Jan 31, 2025 · 0 comments

Comments

@rjollos
Copy link

rjollos commented Jan 31, 2025

Compiler warning with MinGW GCC 14.1.0 compiling with -O3. Not seen compiling with -O0.

Not seen for other compilers:

  • macOS
 clang -v
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  • Ubuntu 24.0.4 GCC 14.2.0
11:09:11  In member function 'void picosha2::hash256_one_by_one::finish()',
11:09:11      inlined from 'void picosha2::impl::hash256_impl(RaIter, RaIter, OutIter, OutIter, int, std::random_access_iterator_tag) [with RaIter = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >; OutIter = unsigned char*]' at ../../../dev-deps/picosha2/includes/picosha2.h:294:18,
11:09:11      inlined from 'void picosha2::hash256(InIter, InIter, OutIter, OutIter, int) [with InIter = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >; OutIter = unsigned char*]' at ../../../dev-deps/picosha2/includes/picosha2.h:323:33,
11:09:11      inlined from 'void picosha2::hash256_hex_string(InIter, InIter, std::string&) [with InIter = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >]' at ../../../dev-deps/picosha2/includes/picosha2.h:346:12:
11:09:11  ../../../dev-deps/picosha2/includes/picosha2.h:210:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
11:09:11    210 |         temp[remains] = 0x80;
11:09:11        |         ~~~~~~~~~~~~~~^~~~~~
11:09:11  ../../../dev-deps/picosha2/includes/picosha2.h: In function 'void picosha2::hash256_hex_string(InIter, InIter, std::string&) [with InIter = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >]':
11:09:11  ../../../dev-deps/picosha2/includes/picosha2.h:206:16: note: at offset 64 into destination object 'temp' of size 64
11:09:11    206 |         byte_t temp[64];
11:09:11        |                ^~~~
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

1 participant