[Bug middle-end/98465] Bogus -Wstringop-overread with -std=gnu++20 -O2 and std::string::insert

Randy at miningrigrentals dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 15 12:40:15 GMT 2022


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

--- Comment #40 from Randy <Randy at miningrigrentals dot com> ---
(In reply to Jonathan Wakely from comment #39)
> (In reply to Randy from comment #38)
> > std::string is not thread safe, this is why vstring is used (from my
> > memory).
> 
> That's totally wrong, vstring has no more thread-safety than std::string
> has. The same rules apply to both of them (it's OK to call const member
> functions concurrently, but any non-const access must be manually
> synchronized by the caller).

I googled, I think I rember now, its due to reference counting. I would get
cases where its deallocating something internally due to the way I pass strings
around to my threads.


More information about the Gcc-bugs mailing list