[llvm-branch-commits] [compiler-rt-branch] r245114 - Merging r244101:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 14 15:40:35 PDT 2015


Author: hans
Date: Fri Aug 14 17:40:35 2015
New Revision: 245114

URL: http://llvm.org/viewvc/llvm-project?rev=245114&view=rev
Log:
Merging r244101:
------------------------------------------------------------------------
r244101 | samsonov | 2015-08-05 12:35:46 -0700 (Wed, 05 Aug 2015) | 6 lines

[UBSan] Fix UBSan-vptr false positive.

Offset from vptr to the start of most-derived object can actually
be positive in some virtual base class vtables.

Patch by Stephan Bergmann!
------------------------------------------------------------------------

Added:
    compiler-rt/branches/release_37/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp
      - copied unchanged from r244101, compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp
Modified:
    compiler-rt/branches/release_37/   (props changed)
    compiler-rt/branches/release_37/lib/ubsan/ubsan_type_hash_itanium.cc

Propchange: compiler-rt/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 14 17:40:35 2015
@@ -1 +1 @@
-/compiler-rt/trunk:242350,242424,242444,242449,242539-242540,242647,242651,243170,243384,243604,243615,243686,244002,244646
+/compiler-rt/trunk:242350,242424,242444,242449,242539-242540,242647,242651,243170,243384,243604,243615,243686,244002,244101,244646

Modified: compiler-rt/branches/release_37/lib/ubsan/ubsan_type_hash_itanium.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_37/lib/ubsan/ubsan_type_hash_itanium.cc?rev=245114&r1=245113&r2=245114&view=diff
==============================================================================
--- compiler-rt/branches/release_37/lib/ubsan/ubsan_type_hash_itanium.cc (original)
+++ compiler-rt/branches/release_37/lib/ubsan/ubsan_type_hash_itanium.cc Fri Aug 14 17:40:35 2015
@@ -185,8 +185,8 @@ namespace {
 
 struct VtablePrefix {
   /// The offset from the vptr to the start of the most-derived object.
-  /// This should never be greater than zero, and will usually be exactly
-  /// zero.
+  /// This will only be greater than zero in some virtual base class vtables
+  /// used during object con-/destruction, and will usually be exactly zero.
   sptr Offset;
   /// The type_info object describing the most-derived class type.
   std::type_info *TypeInfo;
@@ -196,7 +196,7 @@ VtablePrefix *getVtablePrefix(void *Vtab
   if (!Vptr)
     return 0;
   VtablePrefix *Prefix = Vptr - 1;
-  if (Prefix->Offset > 0 || !Prefix->TypeInfo)
+  if (!Prefix->TypeInfo)
     // This can't possibly be a valid vtable.
     return 0;
   return Prefix;




More information about the llvm-branch-commits mailing list