https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80498
--- Comment #13 from jonne <gcc at zutt dot org> --- Thanks for all your help, Martin, I really appreciate. I re-ran with ASAN_OPTIONS as you suggested. The program seems to get killed after about 44 seconds. I already tried with clang before, seems to work ok over there. I'll attach some output for clang below as well. $ g++-6 -g -O0 -fsanitize=address a.cpp m.cpp && ASAN_OPTIONS="verbosity=111" time ./a.out ld: warning: direct access in function '__GLOBAL__sub_D_00099_0_a.cpp' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//ccgQNLgV.o' to global weak symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__cxx11::regex_traits<char>::lookup_collatename<char const*>(char const*, char const*) const::__collatenames' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//ccgQNLgV.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_00099_1_a.cpp' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//ccgQNLgV.o' to global weak symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__cxx11::regex_traits<char>::lookup_collatename<char const*>(char const*, char const*) const::__collatenames' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//ccgQNLgV.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_D_00099_0_m.cpp' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//cc4jwnsQ.o' to global weak symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__cxx11::regex_traits<char>::lookup_collatename<char const*>(char const*, char const*) const::__collatenames' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//ccgQNLgV.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_00099_1_m.cpp' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//cc4jwnsQ.o' to global weak symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__cxx11::regex_traits<char>::lookup_collatename<char const*>(char const*, char const*) const::__collatenames' from file '/var/folders/lq/t18hc5bn0c5bxf7h7nn609f40000gp/T//ccgQNLgV.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ==82606==AddressSanitizer: libc interceptors initialized || `[0x200000000000, 0x7fffffffffff]` || HighMem || || `[0x140000000000, 0x1fffffffffff]` || HighShadow || || `[0x120000000000, 0x13ffffffffff]` || ShadowGap || || `[0x100000000000, 0x11ffffffffff]` || LowShadow || || `[0x000000000000, 0x0fffffffffff]` || LowMem || MemToShadow(shadow): 0x120000000000 0x123fffffffff 0x128000000000 0x13ffffffffff redzone=16 max_redzone=2048 quarantine_size_mb=256M malloc_context_size=30 SHADOW_SCALE: 3 SHADOW_GRANULARITY: 8 SHADOW_OFFSET: 0x100000000000 ==82606==Installed the sigaction for signal 11 ==82606==Installed the sigaction for signal 10 ==82606==SetCurrentThread: 0x00010b11f000 for thread 0x7fffd10413c0 ==82606==T0: stack [0x7fff55412000,0x7fff55c12000) size 0x800000; local=0x7fff55c0d8dc ==82606==AddressSanitizer Init done Command terminated abnormally. 43.62 real 25.29 user 17.61 sys $ time ./a.out Killed: 9 real 0m44.158s user 0m25.271s sys 0m17.923s Using clang: $ clang++ -g -O0 -fsanitize=address a.cpp m.cpp && ASAN_OPTIONS="verbosity=111" time ./a.out ==82808==AddressSanitizer: libc interceptors initialized || `[0x200000000000, 0x7fffffffffff]` || HighMem || || `[0x140000000000, 0x1fffffffffff]` || HighShadow || || `[0x120000000000, 0x13ffffffffff]` || ShadowGap || || `[0x100000000000, 0x11ffffffffff]` || LowShadow || || `[0x000000000000, 0x0fffffffffff]` || LowMem || MemToShadow(shadow): 0x120000000000 0x123fffffffff 0x128000000000 0x13ffffffffff redzone=16 max_redzone=2048 quarantine_size_mb=256M malloc_context_size=30 SHADOW_SCALE: 3 SHADOW_GRANULARITY: 8 SHADOW_OFFSET: 0x100000000000 ==82808==Installed the sigaction for signal 11 ==82808==Installed the sigaction for signal 10 ==82808==SetCurrentThread: 0x000106842000 for thread 0x7fffd10413c0 ==82808==T0: stack [0x7fff5be93000,0x7fff5c693000) size 0x800000; local=0x7fff5c68e920 ==82808==Using atos found at: /usr/bin/atos ==82808==Using dladdr symbolizer. ==82808==AddressSanitizer Init done contiguous_container: 0x60400000f410 0x60400000f440 0x60400000f440 0x60400000f410 contiguous_container: 0x60400000f410 0x60400000f440 0x60400000f410 0x60400000f428 contiguous_container: 0x60400000f410 0x60400000f440 0x60400000f428 0x60400000f440 ... snip ... lots of contiguous_container lines ... contiguous_container: 0x61b00001f180 0x61b00001f780 0x61b00001f780 0x61b00001f4e0 contiguous_container: 0x61b00001f180 0x61b00001f780 0x61b00001f4e0 0x61b00001f480 contiguous_container: 0x60400000f3d0 0x60400000f400 0x60400000f400 0x60400000f400 foo with test 123 0.10 real 0.00 user 0.07 sys