clang lacks undefined behavior sanitizer (ubsan) on FreeBSD?

Dimitry Andric dim at FreeBSD.org
Fri Dec 27 12:10:52 UTC 2013


On 27 Dec 2013, at 12:52, Markiyan Kushnir <markiyan.kushnir at gmail.com> wrote:
> Trying to make benefit out of -fsanitize=undefined and failing on
> 11-CURRENT r259742. A minimal test case:
> 
> 13:45:tmp$ cat ttt.c
> #include <stdio.h>
> 
> int
> main(void)
> {
>    int i, j = 0xffffffff;
> 
>    for (i = 0; i < 2; ++i) {
>        j <<= 1;
>        printf("j=%x\n", j);
>    }
>    return 0;
> }
> 
> 13:45:tmp$ clang -Qunused-arguments -fcolor-diagnostics -g -O0
> -fsanitize=undefined -Wall -Wextra -Werror -std=c99  ttt.c
> /tmp/ttt-RJPqDj.o: In function `main':
> /tmp/ttt.c:9: undefined reference to `__ubsan_handle_shift_out_of_bounds'
> /tmp/ttt.c:8: undefined reference to `__ubsan_handle_add_overflow'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> 
> The ports version (both clang33 and clang34) neither seems to take
> care of it, as I could see in
> llvm.src/tools/clang/runtime/compiler-rt/Makefile
> 
> Am I missing anything?

You are not missing anything, the sanitizers have simply not been ported
yet.  This is a nice project for a New Year's resolution. :-)

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20131227/59f29327/attachment.sig>


More information about the freebsd-hackers mailing list