[Bug lto/82172] Destruction of basic_string in basic_stringbuf::overflow with _GLIBCXX_USE_CXX11_ABI=0, -flto, and C++17 mode results in invalid delete
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 27 09:09:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82172
--- Comment #20 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Gubbins from comment #19)
> (In reply to Martin Liška from comment #18)
> > Issue solved, ld.bfd is responsible.
>
> Unfortunately, the same test program also crashes when built and linked on
> OSX.
>
> I tested with Sierra (OSX 10.12.5), gcc 7.2.0, compiling the original sample
> here with:
>
> g++-7 -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17 -O1 test.cpp
>
> Result:
>
> > ./a.out
> a.out(608,0x7fffbda8a3c0) malloc: *** error for object 0x10c68d080: pointer
> being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Abort trap: 6
>
>
> I think this means the Darwin linker has a similar problem.
Your failure happens even w/o LTO, am I right?
But yes, the problem looks very similar to what happens for ld.bfd.
More information about the Gcc-bugs
mailing list