[PATCH] D93015: Fold comparison of __builtin_object_size expression with -1 for non-const size

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 02:02:03 PST 2020


serge-sans-paille added a comment.

> When __builtin_dynamic_object_size returns a non-constant expression, it cannot be -1 since that is an invalid return value for object size

I disagree with that statement. For instance

  void copy_into_buffer(char* buffer) {
     __builtin___strlcpy_chk(buffer, "some string", strlen("some string"), __builtin_dynamic_object_size(buffer, 0))
   }

In that case, `__builtin_dynamic_object_size` may return -1, e.g. if `copy_into_buffer` has external linkage, and thus no information on `buffer` is available


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93015/new/

https://reviews.llvm.org/D93015



More information about the llvm-commits mailing list