public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/PR101425-fix-offloading-hint)] offloading: fix -foffload hinting
Date: Mon, 12 Jul 2021 09:00:52 +0000 (GMT)	[thread overview]
Message-ID: <20210712090052.998993836017@sourceware.org> (raw)

https://gcc.gnu.org/g:f64d87615ef851d64dc1f58abbf4cf5dc43afc43

commit f64d87615ef851d64dc1f58abbf4cf5dc43afc43
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Jul 12 10:59:06 2021 +0200

    offloading: fix -foffload hinting
    
            sanitizer/101425
    
    gcc/ChangeLog:
    
            * gcc.c (check_offload_target_name): Call
              candidates_list_and_hint only if we have a candidate.

Diff:
---
 gcc/gcc.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index f086dd47b91..16a8aa8f17b 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4015,15 +4015,18 @@ check_offload_target_name (const char *target, ptrdiff_t len)
 
       error ("GCC is not configured to support %qs as offload target", target2);
 
-      const char *hint = candidates_list_and_hint (target2, s, candidates);
       if (candidates.is_empty ())
 	inform (UNKNOWN_LOCATION, "no offloading targets configured");
-      else if (hint)
-	inform (UNKNOWN_LOCATION,
-		"valid offload targets are: %s; did you mean %qs?", s, hint);
       else
-	inform (UNKNOWN_LOCATION, "valid offload targets are: %s", s);
-      XDELETEVEC (s);
+	{
+	  const char *hint = candidates_list_and_hint (target2, s, candidates);
+	  if (hint)
+	    inform (UNKNOWN_LOCATION,
+		    "valid offload targets are: %s; did you mean %qs?", s, hint);
+	  else
+	    inform (UNKNOWN_LOCATION, "valid offload targets are: %s", s);
+	  XDELETEVEC (s);
+	}
       return false;
     }
   return true;


                 reply	other threads:[~2021-07-12  9:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210712090052.998993836017@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).