On Mon, Jan 17, 2022 at 02:59:15PM -0000, Artur Frenszek-Iwicki wrote:
> I tried compiling colobot with the new gcc, expecting it to break in some
> new and fascinating way, and got the following error:
> 
> In function 'std::char_traits<char>::copy(char*, char const*, unsigned long)',
>     inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, 
> std::allocator<char> >::_S_copy(char*, char const*, unsigned long)' at 
> /usr/include/c++/12/bits/basic_string.h:423:21,
>     inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, 
> std::allocator<char> >::_S_copy(char*, char const*, unsigned long)' at 
> /usr/include/c++/12/bits/basic_string.h:418:7,
>     inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, 
> std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, 
> unsigned long)' at /usr/include/c++/12/bits/basic_string.tcc:532:22,
>     inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, 
> std::allocator<char> >::assign(char const*)' at 
> /usr/include/c++/12/bits/basic_string.h:1645:19,
>     inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, 
> std::allocator<char> >::operator=(char const*)' at 
> /usr/include/c++/12/bits/basic_string.h:813:28,
>     inlined from 'Ui::CList::SetItemName(int, 
> std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
> > const&)' at 
> /builddir/build/BUILD/colobot-colobot-gold-0.2.0-alpha/src/ui/controls/list.cpp:664:28:
> /usr/include/c++/12/bits/char_traits.h:431:56: error: 'memcpy' accessing 
> 9223372036854775810 or more bytes at offsets -4611686018427387902 and 
> [-4611686018427387903, 4611686018427387904] may overlap up to 
> 9223372036854775813 bytes at offset -3 [-Werror=restrict]
>   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, 
> __n));
>       |                                        
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
> 
> The relevant bit of code is this line:
>         m_items[i].text =  " ";
> Where the ".text" struct member is an std::string.
> 
> Any suggestions on how to fix this will be appreciated.

Please send me preprocessed source + g++ command line, provided the warning
is reproduceable without -flto.

        Jakub
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to