Clang indeed does not work with cgo. Filed:
https://code.google.com/p/go/issues/detail?id=8788
While gcc 4.8.2 (stock gcc on Ubuntu 14.04) works fine:
$ CC="gcc -fsanitize=address" go run src2.go
=================================================================
==24628== ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60160000aff5 at pc 0x401066 bp 0x7fff5bf8e960 sp 0x7fff5bf8e958
WRITE of size 1 at 0x60160000aff5 thread T0
#0 0x401065
(/tmp/go-build529336755/command-line-arguments/_obj/exe/src2+0x401065)
#1 0x423990
(/tmp/go-build529336755/command-line-arguments/_obj/exe/src2+0x423990)
0x60160000aff5 is located 1 bytes to the right of 100-byte region
[0x60160000af90,0x60160000aff4)
allocated by thread T0 here:
#0 0x7f543595e41a (/usr/lib/x86_64-linux-gnu/libasan.so.0.0.0+0x1541a)
#1 0x401019
(/tmp/go-build529336755/command-line-arguments/_obj/exe/src2+0x401019)
Can you switch to a relatively fresh gcc (like 4.8.2)?
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.