<div dir="ltr">Thank you!</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 1:40 AM, Yury Gribov via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ygribov<br>
Date: Tue Oct 20 03:40:52 2015<br>
New Revision: 250806<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=250806&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=250806&view=rev</a><br>
Log:<br>
[ubsan] Fix looksLikeFloatCastOverflowDataV1 heuristic to work if one of the types is unknown.<br>
<br>
Differential revision: <a href="http://reviews.llvm.org/D13775" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13775</a><br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc<br>
<br>
Modified: compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc?rev=250806&r1=250805&r2=250806&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc?rev=250806&r1=250805&r2=250806&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc (original)<br>
+++ compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc Tue Oct 20 03:40:52 2015<br>
@@ -314,12 +314,14 @@ static bool looksLikeFloatCastOverflowDa<br>
                   sizeof(FilenameOrTypeDescriptor));<br>
<br>
   // Heuristic: For float_cast_overflow, the TypeKind will be either TK_Integer<br>
-  // (0x0) or TK_Float (0x1). Adding both bytes will be 0 or 1 (for BE or LE).<br>
-  // If it were a filename, adding two printable characters will not yield such<br>
-  // a value.<br>
+  // (0x0), TK_Float (0x1) or TK_Unknown (0xff). If both types are known,<br>
+  // adding both bytes will be 0 or 1 (for BE or LE). If it were a filename,<br>
+  // adding two printable characters will not yield such a value. Otherwise,<br>
+  // if one of them is 0xff, this is most likely TK_Unknown type descriptor.<br>
   u16 MaybeFromTypeKind =<br>
       FilenameOrTypeDescriptor[0] + FilenameOrTypeDescriptor[1];<br>
-  return MaybeFromTypeKind < 2;<br>
+  return MaybeFromTypeKind < 2 || FilenameOrTypeDescriptor[0] == 0xff ||<br>
+         FilenameOrTypeDescriptor[1] == 0xff;<br>
 }<br>
<br>
 static void handleFloatCastOverflow(void *DataPtr, ValueHandle From,<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div>