On 04/29/2017 01:17 AM, Marc Glisse wrote:
Hello,

this patch seems rather trivial, once one knows that those functions
always write exactly n characters (they fill with 0 as needed at the end).

Nice!  Now it just needs to be made to work the other way around
too, so the dead str{,n}cpy calls is eliminated:

  void sink (void*);

  void f (const char *s)
  {
    char a[256];

    __builtin_strncpy (a, s, sizeof a);
    __builtin_memset (a, 0, sizeof a);

    sink (a);
  }

I've opened bug 80576 for this small improvement.

Martin

Reply via email to