diff mbox series

[rs6000,committed] Fix AIX bootstrap (don't call asprintf)

Message ID f128257c-6381-5d50-f2bd-08aebc9d4a8d@linux.ibm.com
State New
Headers show
Series [rs6000,committed] Fix AIX bootstrap (don't call asprintf) | expand

Commit Message

Li, Pan2 via Gcc-patches Aug. 23, 2021, 10:36 p.m. UTC
Hi,

My recent commit broke bootstrap for AIX because I was calling asprintf 
without pulling it in from libiberty.h.  Unfortunately, there is a name 
collision between libiberty.h and string.h that I don't immediately know 
how to resolve, so rather than fight it I've just reverted to using 
malloc and sprintf.

Bootstrapped on powerpc64le-linux-gnu, committed as obvious. Sorry for 
the trouble!

Bill


2021-08-23  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (parse_bif_entry): Don't call
	asprintf, which is not available on AIX.
---
  gcc/config/rs6000/rs6000-gen-builtins.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 503099464d6..08dc3b5b956 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -1844,8 +1844,9 @@  parse_bif_entry (void)
    /* Append a number representing the order in which this function
       was encountered to its name, and save in another lookup
       structure.  */
-  char *buf;
-  asprintf (&buf, "%s:%05d", bifs[curr_bif].idname, curr_bif);
+  int orig_len = strlen (bifs[curr_bif].idname);
+  char *buf = (char *) malloc (orig_len + 7);
+  sprintf (buf, "%s:%05d", bifs[curr_bif].idname, curr_bif);
  
    if (!rbt_insert (&bifo_rbt, buf))
      {