[PATCH] D18438: Calculate __builtin_object_size when pointer depends on a condition

Strahinja Petrovic via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 03:29:08 PDT 2016


spetrovic added a comment.

Ok, I will resolve offset problem in this revision. Handling Phis will be different patch after this is committed.
So, I have question about offset problem. For this  example:

int foo(int N) {

  char Small[10];
  char Large[20];
  
  char *Ptr = N ? Small : Large - 19;
  return __builtin_object_size(Ptr,0);

}

int main() {

  size_t ret;
  ret = foo(0);
  printf("\n%d\n", ret);
  return 0;

}

gcc gives 39 as result, I don't think that is correct value, what is your opinion about this case and similar cases ?


Repository:
  rL LLVM

http://reviews.llvm.org/D18438





More information about the llvm-commits mailing list