[PATCH] D22227: [ubsan] Disable bounds-check for flexible array ivars

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 13:42:20 PDT 2016


vsk added a comment.

Thanks for the review!

I looked at the IR and confirmed that the ivars are laid out in the order they're defined, that the indirect ivar offsets make sense, and that the runtime ivar offsets match up with what we expect. E.g;

  @"OBJC_IVAR_$_FlexibleArray1.chars" = global i64 0 ...
  @"\01l_OBJC_$_INSTANCE_VARIABLES_FlexibleArray1" = private global { i32, i32, [1 x %struct._ivar_t] } ...
  
  ---
  
  @"OBJC_IVAR_$_FlexibleArray2.chars" = global i64 0
  @"OBJC_IVAR_$_FlexibleArray2.chars2" = global i64 0 ;; < This offset increases if we sandwich an int between chars and chars2.
  @"\01l_OBJC_$_INSTANCE_VARIABLES_FlexibleArray2" = private global { i32, i32, [2 x %struct._ivar_t] } ...


https://reviews.llvm.org/D22227





More information about the cfe-commits mailing list