public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Request to merge Undefined Behavior Sanitizer in
@ 2013-07-25 15:35 Marek Polacek
  2013-07-25 15:40 ` Marek Polacek
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Marek Polacek @ 2013-07-25 15:35 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jakub Jelinek, Jeff Law, Jason Merrill, Joseph S. Myers

[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]

Hi!

I'd like to announce first version of the Undefined Behavior
Sanitizer, a tool I've spent this June/July hacking on.

It is an undefined behavior detector for the C family FEs
and works by creating a COMPOUND_EXPR around original expression,
for slightly more information  see my slides about ubsan:
http://people.redhat.com/mpolacek/src/ubsan2013.pdf

So far it sanitizes division-by-zeros, shifts and
__builtin_unreachable calls.  This is of course far from being
complete; I intend to write more features during this 4.9 stage.

Apart from the compiler components, ubsan needs a runtime library to
function.  We share that library with the LLVM implementation of
ubsan.  (We do the same for tsan/asan.)

The DejaGNU test harness is a part of this patch and passes with
both -m64 and -m32 (at least on my machine ;), haven't really tried e.g.
PPC or S390, where it could be interesting to try -m31).
I'm not aware of any major issues right now (doesn't mean there aren't
any...), but e.g. how well this works with constexpr is still subject
to discover.

Furthermore, this patch tweaks parsing of -fsanitize= option,
now it is possible to write e.g.
-fsanitize=undefined,address -fno-sanitize=shifts
.  For this, the gcc spec language has been tweaked slightly.

The ChangeLog.ubsan files are meant to disappear at commit
time, as theirs content will be updated and prepended to
the normal ChangeLog files.

I'm attaching the .tar.bz2 archive, which contains the whole patch
together with the ubsan library (located in libsanitizer/).  Everything's
also available on my git only branch ubsan.  I'll also send a patch
that contains everything but libsanitizer/ changes to make
the reviewing hopefully more convenient.

After the merge, we shouldn't forget to update the 
http://gcc.gnu.org/gcc-4.9/changes.html page.

Here I'd like to thank Jakub, without him there would be no ubsan at
all.

Regtested/bootstrapped on x86_64-linux.

Comments?

	Marek

[-- Attachment #2: U.tar.bz2 --]
[-- Type: application/x-bzip2, Size: 37919 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2013-08-23 22:19 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 15:35 Request to merge Undefined Behavior Sanitizer in Marek Polacek
2013-07-25 15:40 ` Marek Polacek
2013-07-25 22:47   ` Joseph S. Myers
2013-07-31 12:59     ` Marek Polacek
2013-07-25 20:23 ` Jason Merrill
2013-07-25 20:32   ` Marek Polacek
2013-07-31 17:49   ` Request to merge Undefined Behavior Sanitizer in (take 2) Marek Polacek
2013-07-31 19:04     ` Jason Merrill
2013-08-01 18:06       ` Marek Polacek
2013-08-03 16:24         ` Jason Merrill
2013-08-05 11:25           ` Marek Polacek
2013-08-06 21:24             ` Jason Merrill
2013-08-07 14:58               ` Marek Polacek
2013-08-15 11:04                 ` Marek Polacek
2013-08-15 15:45                   ` Jason Merrill
2013-08-06 14:42       ` Marek Polacek
2013-08-06 23:07         ` Jason Merrill
2013-08-07 10:07           ` Marek Polacek
2013-08-07 14:25             ` Jason Merrill
2013-08-07 16:13               ` Marek Polacek
2013-08-15  8:00                 ` Marek Polacek
2013-08-15 15:29                   ` Jason Merrill
2013-07-25 22:43 ` Request to merge Undefined Behavior Sanitizer in Joseph S. Myers
2013-07-26  5:33   ` Jeff Law
2013-07-26  6:06     ` Andrew Pinski
2013-07-26 12:11       ` Marek Polacek
2013-07-26 19:25       ` Jason Merrill
2013-07-26 20:06         ` Marc Glisse
2013-07-26 23:07           ` Jason Merrill
2013-07-29 10:09     ` Marek Polacek
2013-07-26  6:51   ` Marc Glisse
2013-08-08 15:57     ` Joseph S. Myers
2013-08-23 23:23       ` Marc Glisse
2013-07-31 11:07   ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).