[PATCH] D13775: Support unknown types in looksLikeFloatCastOverflowDataV1 heuristic.

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 05:02:29 PDT 2015


m.ostepenko updated this revision to Diff 37570.
m.ostepenko added a comment.

Thanks! Addressing Filipe's nit.


Repository:
  rL LLVM

http://reviews.llvm.org/D13775

Files:
  lib/ubsan/ubsan_handlers.cc

Index: lib/ubsan/ubsan_handlers.cc
===================================================================
--- lib/ubsan/ubsan_handlers.cc
+++ lib/ubsan/ubsan_handlers.cc
@@ -314,12 +314,14 @@
                   sizeof(FilenameOrTypeDescriptor));
 
   // Heuristic: For float_cast_overflow, the TypeKind will be either TK_Integer
-  // (0x0) or TK_Float (0x1). Adding both bytes will be 0 or 1 (for BE or LE).
-  // If it were a filename, adding two printable characters will not yield such
-  // a value.
+  // (0x0), TK_Float (0x1) or TK_Unknown (0xff). If both types are known,
+  // adding both bytes will be 0 or 1 (for BE or LE). If it were a filename,
+  // adding two printable characters will not yield such a value. Otherwise,
+  // if one of them is 0xff, this is most likely TK_Unknown type descriptor.
   u16 MaybeFromTypeKind =
       FilenameOrTypeDescriptor[0] + FilenameOrTypeDescriptor[1];
-  return MaybeFromTypeKind < 2;
+  return MaybeFromTypeKind < 2 || FilenameOrTypeDescriptor[0] == 0xff ||
+         FilenameOrTypeDescriptor[1] == 0xff;
 }
 
 static void handleFloatCastOverflow(void *DataPtr, ValueHandle From,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13775.37570.patch
Type: text/x-patch
Size: 1133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151016/0c39b13c/attachment.bin>


More information about the llvm-commits mailing list