[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 9 16:12:45 PDT 2019
xbolva00 added a comment.
In D67986#1687323 <https://reviews.llvm.org/D67986#1687323>, @xbolva00 wrote:
> Oh, I think the proposed transformation in that paper is incorrect.
>
> It should rather be:
> memccpy(d,s,0, n-1)
> d[n-1] = 0
>
> Since "A terminating null character is automatically appended after the content written." (snprintf)
@efriedma, what do you think about this sequence?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67986/new/
https://reviews.llvm.org/D67986
More information about the llvm-commits
mailing list