[PATCH] D67986: [InstCombine] snprintf (d, size, "%s", s) -> memccpy (d, s, '\0', size - 1), d[size - 1] = 0

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 14:13:48 PDT 2019


xbolva00 added a comment.

>> -fno-builtin-memccpy doesn't work because memccpy isn't listed in include/clang/Basic/Builtins.def. We should probably fix that.

Just add new record:
LIBBUILTIN(memccpy, "v*v*vC*iz",   "f",     "string.h", ALL_LANGUAGES)

?

Than great, then linux kernel would just use -fno-builtin-memccpy and we are fine here.

>> Sounds like this should be guarded to only work for simple (non-volatile, non-atomic) pointers?

Good catch, yeah, I will do it.


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

https://reviews.llvm.org/D67986





More information about the llvm-commits mailing list