Looking for some help with GCC 6 and bad code generation

Jonathan Wakely jwakely.gcc@gmail.com
Thu Apr 21 09:43:00 GMT 2016

This is the wrong mailing list for such questions, the gcc-help list
would be appropriate.

On 21 April 2016 at 02:11, Zan Lynx wrote:
> I would like someone to look at this and tell me this is an already
> fixed bug. Or that recent GCC patches may have fixed it. :-)
> Or it would also be great to get some advice on building a reproducer
> without needing to include many megabytes of proprietary code plus Boost.
> I've been using Fedora 24 Alpha and of course I've somehow managed to
> write some C++ code even more confusing for GCC than Firefox. Heh.
> The problem is a crash when std::string tries to free memory from a
> temporary std::string that was bound to a const reference.

This usually means you have a reference to a local or a reference to a
temporary that has gone out of scope. With the COW std::string you
could usually get away with that, because the actual string
representation wasn't always destroyed when objects went out of scope.
With the new std::string you have to be more careful, invalid uses of
destroyed objects result in accesses to deleted or clobbered memory.

More information about the Gcc mailing list