public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108197] New: -Wstringop-overread emitted on simple boost small_vector code
@ 2022-12-22 10:10 steveire at gmail dot com
  2022-12-22 12:10 ` [Bug tree-optimization/108197] [12/13 Regression] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: steveire at gmail dot com @ 2022-12-22 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108197
           Summary: -Wstringop-overread emitted on simple boost
                    small_vector code
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: steveire at gmail dot com
  Target Milestone: ---

```

#include <boost/container/small_vector.hpp>

struct MyThing
{
    int d0 = {};
};

void modify(boost::container::small_vector<MyThing, 10> &pp)
{
    pp.resize(1);

    pp[0].d0 = 3;
}

void foo()
{
    boost::container::small_vector<MyThing, 10> pp2;

    boost::container::small_vector<MyThing, 10> pp;

    pp.resize(1);

    pp[0].d0 = 2;

    pp2 = std::move(pp);
}
```

gives

```
/opt/compiler-explorer/libs/boost_1_80_0/boost/container/detail/copy_move_algo.hpp:184:19:
warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)'
reading between 41 and 9223372036854775804 bytes from a region of size 40
[-Wstringop-overread]
  184 |       std::memmove(dest_raw, beg_raw, sizeof(value_type)*n);
```

https://godbolt.org/z/rs3oj3YoE

Even though modify is never called, it must be in the code to reproduce the
bug.

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

end of thread, other threads:[~2023-05-08 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 10:10 [Bug c++/108197] New: -Wstringop-overread emitted on simple boost small_vector code steveire at gmail dot com
2022-12-22 12:10 ` [Bug tree-optimization/108197] [12/13 Regression] " rguenth at gcc dot gnu.org
2022-12-24 17:21 ` steveire at gmail dot com
2023-01-13 12:49 ` rguenth at gcc dot gnu.org
2023-04-08 14:38 ` law at gcc dot gnu.org
2023-05-08 12:26 ` [Bug tree-optimization/108197] [12/13/14 " 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).