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

Richard Smith richard at metafoo.co.uk
Tue Oct 9 12:48:01 PDT 2012


On Fri, Oct 5, 2012 at 1:03 AM, Kostya Serebryany <kcc at google.com> wrote:

> 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.
>
> Mmm. Even with those two we had issues on windows, which forced us to
> have include/sanitizer/common_interface_defs.h
> Again, just for consistency (and for future windows porting) you may want
> to use common_interface_defs.h instead of system headers.
>

Done.

On Fri, Oct 5, 2012 at 1:28 AM, Kostya Serebryany <kcc at google.com> wrote:

> Other then the includes the patch looks great.


Thanks, committed in r165533.


> Two comments which you may want to address in this or future patches:
>   sanitizer_common has all required code to unwind and print symbolized
> stack. It might be useful for environments that don't have stack
> unwinder/symbolizer on SIGILL.
>   sanitizer_common has Printf which you may want to use instead of
> fprintf(stderr, ..), for consistency and to allow redirecting to another
> file.
>

Thanks, I'll have a look.

On Fri, Oct 5, 2012 at 5:08 AM, Alexey Samsonov <samsonov at google.com> wrote:

> +FUNCTIONS.ubsan-i386 :=
> +FUNCTIONS.ubsan-x86_64 :=
> Do you need to define this analogous to the way we define
> AsanFunctions/TsanFunctions etc. I'm sure what this variable
>

I've taken out the configure/make support for now. It was undertested and I
wasn't confident it was right. We can add it back in with appropriate
testing and validation if there's a desire for that.

On Fri, Oct 5, 2012 at 5:32 AM, Alexey Samsonov <samsonov at google.com> wrote:

> On Fri, Oct 5, 2012 at 4:08 PM, Alexey Samsonov <samsonov at google.com>
>  wrote:
>
>> Hi Richard,
>>
>> The patches are cool
>>
>> +/// \brief A description of a type.
>> +class TypeDescriptor {
>> Why don't use bitfields for TypeDescriptor?
>>
>
I've switched to using two u16 fields and added explanatory comments.

On Tue, Oct 9, 2012 at 1:46 AM, Alexey Samsonov <samsonov at google.com> wrote:

> On Tue, Oct 9, 2012 at 1:29 AM, Michael Spencer <bigcheesegs at gmail.com>
>  wrote:
>
>> 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.
>

Thanks, I've switched over to using it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121009/77511b20/attachment.html>


More information about the cfe-commits mailing list