From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 27 12:10:52 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5330862 for ; Fri, 27 Dec 2013 12:10:52 +0000 (UTC) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6018B1AAA for ; Fri, 27 Dec 2013 12:10:52 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::d9e4:f89e:72fa:1b31] (unknown [IPv6:2001:7b8:3a7:0:d9e4:f89e:72fa:1b31]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 226D55C43; Fri, 27 Dec 2013 13:10:47 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_B651A417-FD9C-4D09-857C-FA565F60BA35"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: clang lacks undefined behavior sanitizer (ubsan) on FreeBSD? From: Dimitry Andric In-Reply-To: Date: Fri, 27 Dec 2013 13:10:34 +0100 Message-Id: <0B8421FE-0481-4EAA-B89B-A1843F97AC5D@FreeBSD.org> References: To: Markiyan Kushnir X-Mailer: Apple Mail (2.1827) Cc: freebsd-hackers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2013 12:10:52 -0000 --Apple-Mail=_B651A417-FD9C-4D09-857C-FA565F60BA35 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 27 Dec 2013, at 12:52, Markiyan Kushnir = wrote: > Trying to make benefit out of -fsanitize=3Dundefined and failing on > 11-CURRENT r259742. A minimal test case: >=20 > 13:45:tmp$ cat ttt.c > #include >=20 > int > main(void) > { > int i, j =3D 0xffffffff; >=20 > for (i =3D 0; i < 2; ++i) { > j <<=3D 1; > printf("j=3D%x\n", j); > } > return 0; > } >=20 > 13:45:tmp$ clang -Qunused-arguments -fcolor-diagnostics -g -O0 > -fsanitize=3Dundefined -Wall -Wextra -Werror -std=3Dc99 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) >=20 > 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 >=20 > 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 --Apple-Mail=_B651A417-FD9C-4D09-857C-FA565F60BA35 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iEYEARECAAYFAlK9bkQACgkQsF6jCi4glqO+0gCgzJEntT2Mz5fLm4M6QiRhgO6q pBAAoKmJRqS149tsye17NgzyxLE69eTd =099m -----END PGP SIGNATURE----- --Apple-Mail=_B651A417-FD9C-4D09-857C-FA565F60BA35--