Hi, On Sun, 26 Jul 2015 12:34:22 -0700 Konstantin Serebryany <[email protected]> wrote:
> First, is that clang or gcc, and which version? > Second, is that C or C++? C, both gcc and clang, no difference. > If this is C, try adding -fno-common (in C, some of the globals are > not instrumented with asan unless you use -fno-common). Okay, with -fno-common I get an error. That's interesting to know, it sounds like -fno-common is a useful addition to asan when trying to find bugs. > Finally, artificial tests like this are often misleading because the > compiler statically sees the bug and should warn about it, > but also can optimize the code away before asan has a chance to > instrument the code. > Try to prepare a test where the bug is not easy to discover > statically. That's actually also interesting. clang will warn about this bug compile-time, gcc won't. Seems gcc doesn't have any checks for static out of bounds access at all. However a small change, using something like int b;int c=a[b]; will already beat the clang warning and the behavior will be the same. cu, -- Hanno Böck http://hboeck.de/ mail/jabber: [email protected] GPG: BBB51E42 -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
pgp8uWQokIZPY.pgp
Description: OpenPGP digital signature
