https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82172
Gubbins <dave.gittins at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dave.gittins at gmail dot com --- Comment #19 from Gubbins <dave.gittins at gmail dot com> --- (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.