public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mattias.ellert at physics dot uu.se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/104336] bogus -Wrestrict for std::string assignment with
Date: Mon, 25 Apr 2022 19:11:15 +0000	[thread overview]
Message-ID: <bug-104336-4-84IjGQQqRV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104336-4@http.gcc.gnu.org/bugzilla/>

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

Mattias Ellert <mattias.ellert at physics dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mattias.ellert at physics dot uu.s
                   |                            |e

--- Comment #1 from Mattias Ellert <mattias.ellert at physics dot uu.se> ---
Created attachment 52872
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52872&action=edit
Proposed fix

Proposed fix:

``` {.diff}
--- usr/include/c++/12/bits/basic_string.tcc.orig       2022-04-14
01:23:43.000000000 +0200
+++ usr/include/c++/12/bits/basic_string.tcc    2022-04-25 16:18:57.028352162
+0200
@@ -527,10 +527,10 @@
                    }
                  else
                    {
-                     const size_type __nleft = (__p + __len1) - __s;
-                     this->_S_move(__p, __s, __nleft);
-                     this->_S_copy(__p + __nleft, __p + __len2,
-                                   __len2 - __nleft);
+                     const size_type __nleft = (__s + __len2) - (__p +
__len1);
+                     this->_S_move(__p, __s, __len2 - __nleft);
+                     this->_S_copy(__p + __len2 - __nleft, __p + __len2,
+                                   __nleft);
                    }
                }
            }
```

  parent reply	other threads:[~2022-04-25 19:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 21:24 [Bug tree-optimization/104336] New: " msebor at gcc dot gnu.org
2022-02-01 21:25 ` [Bug tree-optimization/104336] " msebor at gcc dot gnu.org
2022-04-25 19:11 ` mattias.ellert at physics dot uu.se [this message]
2022-04-25 20:26 ` amacleod at redhat dot com
2022-05-02 12:45 ` rguenth 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-104336-4-84IjGQQqRV@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).