This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix Werror=stringop-overflow in target.c
- From: Martin Liška <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Martin Sebor <msebor at gmail dot com>
- Date: Mon, 20 Nov 2017 14:58:49 +0100
- Subject: [PATCH] Fix Werror=stringop-overflow in target.c
- Authentication-results: sourceware.org; auth=none
Hello.
This is fix of compilation error I see with --enable-offload-targets=nvptx-none=. It's explained
in very detail way here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83007#c1
Ready for trunk?
Martin
libgomp/ChangeLog:
2017-11-20 Martin Liska <mliska@suse.cz>
* target.c (gomp_target_init): Use proper string operation.
---
libgomp/target.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libgomp/target.c b/libgomp/target.c
index 8ac05e8c641..4838dc98de6 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -2668,7 +2668,10 @@ gomp_target_init (void)
}
strcpy (plugin_name, prefix);
- strncat (plugin_name, cur, next ? next - cur : strlen (cur));
+ if (next)
+ strncat (plugin_name, cur, next - cur);
+ else
+ strcpy (plugin_name, cur);
strcat (plugin_name, suffix);
if (gomp_load_plugin_for_device (¤t_device, plugin_name))