get memcpy EXC_BAD_ACCESS only with LTO on multi platform!

Innot Sagg donovinsbbkgbi at gmail.com
Sat Jul 18 06:12:05 UTC 2020


On Saturday, 18 July 2020 at 04:55:44 UTC, Kagamin wrote:
> Try -fsanitize=undefined

After add -fsanitize=address, lto build no problem.

Build without lto raise problem macOS:

Undefined symbols for architecture x86_64:
   "___asan_version_mismatch_check_apple_clang_1103", referenced 
from:
       _asan.module_ctor in libmyhelp.a(mycode.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to 
see invocation)

libmyhelp.a is the c static build with clang -fsanitize=address.

If also pass -fsanitize=address to the clang when it called by 
ldc doing the link work. (ldc2 lto or non-lto same error)  I get 
this runtime error:


=================================================================
==52571==ERROR: AddressSanitizer: unknown-crash on address 
0x1c8000000000 at pc 0x000100129ff8 bp 0x7ffeefbfdda0 sp 
0x7ffeefbfd560
WRITE of size 1536 at 0x1c8000000000 thread T0
AddressSanitizer:DEADLYSIGNAL
=================================================================
==52571==ERROR: AddressSanitizer: BUS on unknown address 
0x624000000010 (pc 0x000100117c21 bp 0x7ffeefbfb320 sp 
0x7ffeefbfb300 T16777215)
     <empty stack>

==52571==Register values:
rax = 0x0000624000000000  rbx = 0x000000010271f060  rcx = 
0x000061d000000070  rdx = 0x00007ffeefbfb3f8
rdi = 0x000000010271f060  rsi = 0x000000010271f0e0  rbp = 
0x00007ffeefbfb320  rsp = 0x00007ffeefbfb300
  r8 = 0x0000000000000828   r9 = 0x00000fffffffffff  r10 = 
0x0000000000000000  r11 = 0xffffffffffffffff
r12 = 0x00007ffeefbfb3f8  r13 = 0x00007ffeefbfb3f8  r14 = 
0x0000000000000828  r15 = 0x000061d000000070
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: BUS
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.



More information about the digitalmars-d-ldc mailing list