public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvb at cyberscience dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105545] New: Compiling string assignment with _GLIBCXX_ASSERTIONS defined fails in 12.1.0, works in 11.1.0
Date: Tue, 10 May 2022 11:15:33 +0000	[thread overview]
Message-ID: <bug-105545-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2022-05-10 11:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 11:15 jvb at cyberscience dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105545-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).