public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105545] New: Compiling string assignment with _GLIBCXX_ASSERTIONS defined fails in 12.1.0, works in 11.1.0
@ 2022-05-10 11:15 jvb at cyberscience dot com
  2022-05-10 11:18 ` [Bug c++/105545] [12/13 Regression] Compiling string assignment with _GLIBCXX_ASSERTIONS fails since r12-3347-g8af8abfbbace49e6 marxin at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jvb at cyberscience dot com @ 2022-05-10 11:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105545

            Bug ID: 105545
           Summary: Compiling string assignment with _GLIBCXX_ASSERTIONS
                    defined fails in 12.1.0, works in 11.1.0
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvb at cyberscience dot com
  Target Milestone: ---

Compiling using -D_GLIBCXX_ASSERTIONS fails in gcc 12.1.0, worked in 11.1.0:

  #include <string>
  extern std::string a();

  std::string a()
  {
    std::string x;
    x.assign( "Z" );
    return x;
  }

using command line:

   g++ -m64 -c -std=gnu++17 -Wall -O3 -Werror -D_GLIBCXX_ASSERTIONS  x.cpp

fails with:

In file included from /usr/local/gcc-12.1.0/include/c++/12.1.0/string:40,
                 from x.cpp:14:
In static member function ??static std::char_traits<char>::char_type*
std::char_traits<char>::copy(char_type*, const char_type*, std::size_t)??,
    inlined from ??static void std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::_S_copy(_CharT*, const _CharT*, size_type) [with _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]?? at
/usr/local/gcc-12.1.0/include/c++/12.1.0/bits/basic_string.h:423:21,
    inlined from ??std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_replace(size_type,
size_type, const _CharT*, size_type) [with _CharT = char; _Traits =
std::char_traits<char>; _Alloc = std::allocator<char>]?? at
/usr/local/gcc-12.1.0/include/c++/12.1.0/bits/basic_string.tcc:532:22,
    inlined from ??std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*)
[with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]?? at
/usr/local/gcc-12.1.0/include/c++/12.1.0/bits/basic_string.h:1647:19,
    inlined from ??std::string a()?? at x.cpp:22:12:
/usr/local/gcc-12.1.0/include/c++/12.1.0/bits/char_traits.h:431:56: error:
??void* __builtin_memcpy(void*, const void*, long unsigned int)?? accessing
9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 17
may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict]
  431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2,
__n));
      |                                       
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-04-20 12:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 11:15 [Bug c++/105545] New: Compiling string assignment with _GLIBCXX_ASSERTIONS defined fails in 12.1.0, works in 11.1.0 jvb at cyberscience dot com
2022-05-10 11:18 ` [Bug c++/105545] [12/13 Regression] Compiling string assignment with _GLIBCXX_ASSERTIONS fails since r12-3347-g8af8abfbbace49e6 marxin at gcc dot gnu.org
2022-05-10 12:26 ` [Bug c++/105545] [12/13 Regression] Warning for string assignment with _GLIBCXX_ASSERTIONS " redi at gcc dot gnu.org
2022-05-11  7:19 ` [Bug tree-optimization/105545] " rguenth at gcc dot gnu.org
2022-05-12 15:17 ` ed at catmur dot uk
2022-05-12 15:51 ` tom at compton dot nu
2022-05-12 16:00 ` tom at compton dot nu
2022-05-31  7:33 ` tom at compton dot nu
2022-06-21 15:35 ` pdimov at gmail dot com
2022-11-03 18:07 ` pdimov at gmail dot com
2023-04-17 16:39 ` [Bug tree-optimization/105545] [12/13/14 " jvb at cyberscience dot com
2023-04-20 12:00 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).