[PATCH] ubsan: add 'UndefinedBehaviorSanitizer' to messages

Alexey Samsonov vonosmas at gmail.com
Mon Nov 10 15:08:42 PST 2014


I'm opposed to this change. The error messages you suggest are occasionaly confusing
  UndefinedBehaviorSanitizer function error
or way too redundant
  UndefinedBehaviorSanitizer unsigned-integer-overflow error: unsigned integer overflow:

Also, if UBSan is combined with another sanitizer (most notably, ASan), we treat the latter as the "main" tool, and don't mention UBSan in error reports. For instance,
look at the SUMMARY: line that would be emiited in this case:
  SUMMARY: AddressSanitizer: undefined-behavior: file.cc:10

I'd prefer to replace generic "runtime error" with generic "undefined-behavior" (or at least make it a common prefix). I also like the idea of specifying the exact -fsanitize= flag that caused the error (what Richard suggests), if that's easily doable.

================
Comment at: lib/ubsan/ubsan_handlers.cc:19
@@ -18,1 +18,3 @@
 
+#include <string.h>
+
----------------
It's not allowed to #include system headers into generic sanitizer runtimes.

================
Comment at: lib/ubsan/ubsan_handlers.cc:348
@@ +347,3 @@
+  const char *Name;
+  if (!strcmp(Data->Type.getTypeName(), "'bool'")) // XXX(mathstuf): Is there a better way to do this?
+    Name = "bool";
----------------
This is wrong, this type of check is also emitted for bool-like types.

http://reviews.llvm.org/D5629






More information about the llvm-commits mailing list