[Bug sanitizer/65285] __asan_describe_address crashes when used with global variable
kcc at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 2 23:32:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65285
--- Comment #4 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
(In reply to Peter Wu from comment #3)
> GCC 4.9.2 cannot include the headers, it blows up on lines such as:
> In file included from
> /usr/lib/clang/3.5.1/include/sanitizer/common_interface_defs.h:16:0,
> from
> /usr/lib/clang/3.5.1/include/sanitizer/asan_interface.h:17,
> from <stdin>:1:
> /usr/lib/clang/3.5.1/include/stddef.h:42:42: error: missing binary operator
> before token "("
> #if !defined(_PTRDIFF_T) || __has_feature(modules)
> ...
>
> (gcc -I/usr/lib/clang/3.5.1/include ...)
>
> With clang 3.5.1, it works, but *only* with "-x c++" and not "-x c".
This should work with clang trunk.
I think I know what your problem is.
In C, the globals by default have common linkage and asan does not instrument
them at all and thus can not properly report them.
Use -fno-common with C.
https://code.google.com/p/address-sanitizer/wiki/Flags
More information about the Gcc-bugs
mailing list