[llvm-commits] [cfe-commits] [PATCH] Add -fcatch-undefined-behavior runtime library

Alexey Samsonov samsonov at google.com
Tue Oct 9 01:46:27 PDT 2012


On Tue, Oct 9, 2012 at 1:29 AM, Michael Spencer <bigcheesegs at gmail.com>wrote:

> On Thu, Oct 4, 2012 at 11:48 AM, Richard Smith <richard at metafoo.co.uk>
> wrote:
> > On Thu, Oct 4, 2012 at 3:36 AM, Kostya Serebryany <kcc at google.com>
> wrote:
> >>
> >>
> >> asan/tsan/msan generally avoid #including system headers, especially in
> .h
> >> files.
> >> Once you start porting the code to non-linux, you'll know why.
> >> compiler-rt/lib/sanitizer_common contains lots of useful stuff that
> allows
> >> you to avoid using system headers.
> >> WDYT?
> >
> >
> > I was trying to steer clear of most system headers, but I've tried a bit
> > harder now; new patch attached.
> >
> > I'm not concerned about the includes in ubsan_diag.cc, since I intend for
> > that code to be replaced in the medium term (and to be made
> user-replaceable
> > -- some applications will want to provide their own reporting
> > functionality). That only leaves <stdint.h> and <stddef.h>, which are
> both
> > provided by Clang. I'm not hugely interested in making the runtime build
> > with any other compiler, since you need to have a Clang which can target
> > your platform anyway in order for it to be useful.
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
>
> This fails to compile with -Werror. ubsan_value.cc has 3 functions
> with something similar to:
>
>   SIntMax Value::getSIntValue() const {
>     ...
>     CHECK(0 && "unexpected bit width");
>   }
>
> Adding __builtin_unreachable(); fixes this. Does compiler-rt have a
> compatibility macro for this?
>

Good idea. I've added UNREACHABLE(msg) macro to common sanitizer defs in
r165492.



>
> - Michael Spencer
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121009/8b92a305/attachment.html>


More information about the llvm-commits mailing list