diff options
author | Martin Liska <mliska@suse.cz> | 2021-07-12 10:59:06 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-07-12 11:35:03 +0200 |
commit | 9b8b37d1b6301855213b8d4860feaeb74d464c6b (patch) | |
tree | fd4accb23e62a1725118a14652f5ac6834b546ee | |
parent | 1e72c24d2f3b1427f5e117e371928e7af50d2036 (diff) | |
download | gcc-9b8b37d1b6301855213b8d4860feaeb74d464c6b.zip gcc-9b8b37d1b6301855213b8d4860feaeb74d464c6b.tar.gz gcc-9b8b37d1b6301855213b8d4860feaeb74d464c6b.tar.bz2 |
offloading: fix -foffload hinting
PR sanitizer/101425
gcc/ChangeLog:
* gcc.c (check_offload_target_name): Call
candidates_list_and_hint only if we have a candidate.
-rw-r--r-- | gcc/gcc.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -4001,7 +4001,6 @@ check_offload_target_name (const char *target, ptrdiff_t len) } if (!c) { - char *s; auto_vec<const char*> candidates; size_t olen = strlen (OFFLOAD_TARGETS) + 1; char *cand = XALLOCAVEC (char, olen); @@ -4015,15 +4014,19 @@ 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); + { + char *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; |