public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109563] New: accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
@ 2023-04-20  4:39 f.heckenbach@fh-soft.de
  2023-04-20  4:44 ` [Bug tree-optimization/109563] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: f.heckenbach@fh-soft.de @ 2023-04-20  4:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109563
           Summary: accessing 9223372036854775810 or more bytes at offsets
                    [2, 9223372036854775807] and 1 may overlap up to
                    9223372036854775813 bytes at offset -3 [-Wrestrict]
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenbach@fh-soft.de
  Target Milestone: ---

I'd like to know if the warning is bogus or the library actually accesses
invalid memory.

% cat test.cpp
#include <string>

void f (const std::string &s)
{
  "x" + std::string (s);
}
% g++ --std=c++20 -O3 -Wall -c test.cpp
In file included from /usr/include/c++/12/string:40,
                 from test.cpp:1:
In static member function ‘static constexpr std::char_traits<char>::char_type*
std::char_traits<char>::copy(char_type*, const char_type*, std::size_t)’,
    inlined from ‘static constexpr 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/include/c++/12/bits/basic_string.h:423:21,
    inlined from ‘constexpr 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/include/c++/12/bits/basic_string.tcc:532:22,
    inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>& std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::replace(size_type, size_type, const _CharT*, size_type) [with _CharT =
char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/usr/include/c++/12/bits/basic_string.h:2171:19,
    inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type,
const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ at /usr/include/c++/12/bits/basic_string.h:1928:22,
    inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits,
_Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT,
_Traits, _Allocator>&&) [with _CharT = char; _Traits = char_traits<char>;
_Alloc = allocator<char>]’ at /usr/include/c++/12/bits/basic_string.h:3541:36,
    inlined from ‘void f(const std::string&)’ at test.cpp:5:7:
/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void*
__builtin_memcpy(void*, const void*, long unsigned int)’ accessing
9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may
overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
  431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2,
__n));
      |

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

* [Bug tree-optimization/109563] accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
  2023-04-20  4:39 [Bug c++/109563] New: accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict] f.heckenbach@fh-soft.de
@ 2023-04-20  4:44 ` pinskia at gcc dot gnu.org
  2023-04-20  4:49 ` f.heckenbach@fh-soft.de
  2023-04-20  9:02 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-20  4:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 105651.

*** This bug has been marked as a duplicate of bug 105651 ***

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

* [Bug tree-optimization/109563] accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
  2023-04-20  4:39 [Bug c++/109563] New: accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict] f.heckenbach@fh-soft.de
  2023-04-20  4:44 ` [Bug tree-optimization/109563] " pinskia at gcc dot gnu.org
@ 2023-04-20  4:49 ` f.heckenbach@fh-soft.de
  2023-04-20  9:02 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: f.heckenbach@fh-soft.de @ 2023-04-20  4:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Frank Heckenbach <f.heckenbach@fh-soft.de> ---
Since I can't easily upgrade to trunk, I need to know if the warning is bogus
in 12.2 and I can safely disable it, or do I need to worry about the generated
code?

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

* [Bug tree-optimization/109563] accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
  2023-04-20  4:39 [Bug c++/109563] New: accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict] f.heckenbach@fh-soft.de
  2023-04-20  4:44 ` [Bug tree-optimization/109563] " pinskia at gcc dot gnu.org
  2023-04-20  4:49 ` f.heckenbach@fh-soft.de
@ 2023-04-20  9:02 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-20  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Frank Heckenbach from comment #2)
> Since I can't easily upgrade to trunk, I need to know if the warning is
> bogus in 12.2 and I can safely disable it, or do I need to worry about the
> generated code?

the warning is bogus

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20  4:39 [Bug c++/109563] New: accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict] f.heckenbach@fh-soft.de
2023-04-20  4:44 ` [Bug tree-optimization/109563] " pinskia at gcc dot gnu.org
2023-04-20  4:49 ` f.heckenbach@fh-soft.de
2023-04-20  9:02 ` rguenth 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).