[Bug tree-optimization/88814] transform snprintf into memccpy
david.bolvansky at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Oct 2 21:28:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88814
Dávid Bolvanský <david.bolvansky at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david.bolvansky at gmail dot com
--- Comment #2 from Dávid Bolvanský <david.bolvansky at gmail dot com> ---
You cannot [0] do this general transformation..
Runtime variable n = 10.
d[9] = 'A';
snprintf(d, n, "%s", s) // s is "str"
assert(d[9] == 'A');
=>
d[9] = 'A';
memccpy(d, s, 0, 9);
d[9] = 0;
assert(d[9] == 'A');
[0] https://reviews.llvm.org/D67986
More information about the Gcc-bugs
mailing list