From 42c544b0356f01207f596fcb5a07e04fd3f61e71 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Sat, 11 Nov 2017 17:43:48 +0000 Subject: [PATCH] PR bootstrap/82948 - prefix.c:202:15: error: 'char* strncpy(char*, const char*, size_t)' destination unchanged after copying no bytes gcc/ChangeLog: PR bootstrap/82948 * prefic.c (translate_name): Replace strncpy with memcpy to avoid -Wstringop-truncation. From-SVN: r254658 --- gcc/ChangeLog | 6 ++++++ gcc/prefix.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23f0197c689..18224e9ccba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-11-11 Martin Sebor + + PR bootstrap/82948 + * prefic.c (translate_name): Replace strncpy with memcpy to + avoid -Wstringop-truncation. + 2017-11-10 Jan Hubicka * tree-ssa-loop-im.c (execute_sm_if_changed): Do not compute freq_sum. diff --git a/gcc/prefix.c b/gcc/prefix.c index b40e9c48a0d..ae098589279 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -199,7 +199,7 @@ translate_name (char *name) ; key = (char *) alloca (keylen + 1); - strncpy (key, &name[1], keylen); + memcpy (key, &name[1], keylen); key[keylen] = 0; if (code == '@') -- 2.30.2