https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93232
Bug ID: 93232 Summary: std::array warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.htm l#index-Wstringop-overflow=-Wstringop-overflow=m] Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: euloanty at live dot com Target Milestone: --- https://bitbucket.org/ejsvifq_mabmip/fast_io/src/master/examples/0021.benchmark/output_10M_size_t.cc I can only repeat this bug on this code. I cannot find out why. D:\hg\w4\fast_io\examples\0021.benchmark>g++ -o output_10M_size_t output_10M_size_t.cc -Ofast -std=c++2a -s In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::binary_to_text<false>, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::binary_to_text<false>, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::binary_to_text<false>, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::ascii_to_ebcdic, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::ascii_to_ebcdic, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::ascii_to_ebcdic, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ D:\hg\w4\fast_io\examples\0021.benchmark>g++ -o output_10M_size_t output_10M_size_t.cc -Ofast -std=c++2a -s In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::binary_to_text<false>, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::binary_to_text<false>, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::binary_to_text<false>, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::ascii_to_ebcdic, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::ascii_to_ebcdic, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems; | ^~~~~~~~ In file included from ../../include/fast_io_core.h:38, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: In function 'constexpr void fast_io::details::output_base_number(output&, U) [with char8_t base = 10; bool uppercase = false; bool ln = true; output = fast_io::otransform_function_default_construct<fast_io::basic_obuf<fast_io::basic_file_wrapper<fast_io::basic_win32_file<char>, 68> >, fast_io::ascii_to_ebcdic, char, 4096, false>; U = long long unsigned int]', inlined from 'int main()' at ../../include/fast_io_core_impl/base.h:631:44: ../../include/fast_io_core_impl/base.h:203:17: warning: writing 1 byte into a region of size 0 [ttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=m] 203 | *--reserved=u8'\n'; | ~~~~~~~~~~~^~~~~~~ In file included from D:/msys64/mingw64/include/c++/10.0.0/tuple:39, from D:/msys64/mingw64/include/c++/10.0.0/bits/unique_ptr.h:37, from D:/msys64/mingw64/include/c++/10.0.0/memory:82, from ../../include/fast_io_core.h:20, from ../../include/fast_io_freestanding.h:5, from ../../include/fast_io_hosted.h:10, from ../../include/fast_io.h:3, from timer.h:5, from output_10M_size_t.cc:1: D:/msys64/mingw64/include/c++/10.0.0/array: In function 'int main()': D:/msys64/mingw64/include/c++/10.0.0/array:110:56: note: at offset -1 to object 'std::array<char, 4096>::_M_elems' with size 4096 declared here 110 | typename _AT_Type::_Type _M_elems;