public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] gcc.c: Silence warning in check_offload_target_name
@ 2021-06-29 14:39 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2021-06-29 14:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6f08285014b8fbe987041b367417425c09041fb7

commit 6f08285014b8fbe987041b367417425c09041fb7
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Jun 29 16:38:37 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.
    
    (cherry picked from commit af9987e817f54806a18e45c5615b9a95b690e537)

Diff:
---
 gcc/gcc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 845b3b8bb8f..d23ea5860ce 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3998,13 +3998,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:39 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:39 [gcc/devel/omp/gcc-11] 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).