public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kcc at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/65285] __asan_describe_address crashes when used with global variable
Date: Mon, 02 Mar 2015 23:32:00 -0000	[thread overview]
Message-ID: <bug-65285-4-g6GdVTaxEE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65285-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2015-03-02 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 22:50 [Bug sanitizer/65285] New: " peter at lekensteyn dot nl
2015-03-02 22:53 ` [Bug sanitizer/65285] " kcc at gcc dot gnu.org
2015-03-02 22:54 ` kcc at gcc dot gnu.org
2015-03-02 23:29 ` peter at lekensteyn dot nl
2015-03-02 23:32 ` kcc at gcc dot gnu.org [this message]
2015-03-02 23:58 ` peter at lekensteyn dot nl
2015-03-03  0:02 ` kcc at gcc dot gnu.org
2015-03-03 23:49 ` peter at lekensteyn dot nl
2015-03-03 23:52 ` kcc at gcc dot gnu.org
2015-03-04  0:58 ` peter at lekensteyn dot nl
2015-03-04  1:00 ` kcc at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65285-4-g6GdVTaxEE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).