[PATCH] D42249: [CodeGenCXX] annotate a GEP to a derived class with 'inbounds' (PR35909)

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 11:25:22 PST 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/CGClass.cpp:410
+
+  // The GEP is to a derived object, so this GEP must be 'inbounds'.
+  Value = Builder.CreateInBoundsGEP(Value, Builder.CreateNeg(NonVirtualOffset),
----------------
Not sure this comment really adds anything, unless you want to cite the standard.


================
Comment at: test/CodeGenCXX/catch-undef-behavior.cpp:391
   // Alignment check from EmitTypeCheck(TCK_DowncastReference, ...)
-  // CHECK:      [[SUB:%[.a-z0-9]*]] = getelementptr i8, i8* {{.*}}, i64 -16
+  // CHECK:      [[SUB:%[.a-z0-9]*]] = getelementptr inbounds i8, i8* {{.*}}, i64 -16
   // CHECK-NEXT: [[C:%.+]] = bitcast i8* [[SUB]] to %class.C*
----------------
We probably want a test which checks the output when ubsan isn't enabled.


https://reviews.llvm.org/D42249





More information about the cfe-commits mailing list