public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: host_detect_local_cpu, init ret with concat [PR112759]
@ 2023-12-18  3:44 YunQiang Su
  2023-12-18  3:44 ` [PATCH 2/2] libiberty/reconcat: Add note about append string to NULL YunQiang Su
  2023-12-18  8:10 ` [PATCH 1/2] MIPS: host_detect_local_cpu, init ret with concat [PR112759] Jakub Jelinek
  0 siblings, 2 replies; 5+ messages in thread
From: YunQiang Su @ 2023-12-18  3:44 UTC (permalink / raw)
  To: gcc-patches
  Cc: ian, pinskia, matoro_mailinglist_gcc-patches, jakub, YunQiang Su

The function `reconcat` cannot append string(s) to NULL,
as the concat process will stop at the first NULL.

Let's initialize `ret` with `concat (" ", NULL)`, then
it can be used by reconcat.

gcc/

	PR target/112759
	* config/mips/driver-native.cc (host_detect_local_cpu):
	initialize ret with concat, so that it can be used by
	reconcat later.
---
 gcc/config/mips/driver-native.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/mips/driver-native.cc b/gcc/config/mips/driver-native.cc
index afc276f5278..471d1925eff 100644
--- a/gcc/config/mips/driver-native.cc
+++ b/gcc/config/mips/driver-native.cc
@@ -44,7 +44,7 @@ const char *
 host_detect_local_cpu (int argc, const char **argv)
 {
   const char *cpu = NULL;
-  char *ret = NULL;
+  char *ret = concat(" ", NULL);
   char buf[128];
   FILE *f;
   bool arch;
-- 
2.39.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-18 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-18  3:44 [PATCH 1/2] MIPS: host_detect_local_cpu, init ret with concat [PR112759] YunQiang Su
2023-12-18  3:44 ` [PATCH 2/2] libiberty/reconcat: Add note about append string to NULL YunQiang Su
2023-12-18  7:56   ` Jakub Jelinek
2023-12-18  8:10 ` [PATCH 1/2] MIPS: host_detect_local_cpu, init ret with concat [PR112759] Jakub Jelinek
2023-12-18 22:59   ` YunQiang Su

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).