public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1903] gcc.c: Silence warning in check_offload_target_name
@ 2021-06-29 14:36 Tobias Burnus
0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2021-06-29 14:36 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:af9987e817f54806a18e45c5615b9a95b690e537
commit r12-1903-gaf9987e817f54806a18e45c5615b9a95b690e537
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Tue Jun 29 16:35:42 2021 +0200
gcc.c: Silence warning in check_offload_target_name
gcc/ChangeLog:
* gcc.c (check_offload_target_name): Cast len argument to
%q.*s to 'int'; avoid -Wstringop-truncation warning.
Diff:
---
gcc/gcc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index df9b2192873..9baa7d67c76 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4004,13 +4004,15 @@ check_offload_target_name (const char *target, ptrdiff_t len)
n = strchr (c, ',');
if (n == NULL)
n = strchr (c, '\0');
+ if (n - c == 0)
+ break;
strncpy (cand, c, n - c);
cand[n - c] = '\0';
candidates.safe_push (cand);
c = *n ? n + 1 : NULL;
}
error ("GCC is not configured to support %q.*s as offload target",
- len, target);
+ (int) len, target);
const char *hint = candidates_list_and_hint (target, s, candidates);
if (hint)
inform (UNKNOWN_LOCATION,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-29 14:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 14:36 [gcc r12-1903] gcc.c: Silence warning in check_offload_target_name Tobias Burnus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).