This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix segfault with dump files


Some old Solaris libcs don't like being passed a NULL pointer as the string 
parameter corresponding to the %s marker of formatting functions.

Fixed thusly, tested on SPARC/Solaris, applied on the mainline as obvious.


2017-11-07  Eric Botcazou  <ebotcazou@adacore.com>

	* gimple-pretty-print.c (dump_profile): Return "" instead of NULL.

-- 
Eric Botcazou
Index: gimple-pretty-print.c
===================================================================
--- gimple-pretty-print.c	(revision 254449)
+++ gimple-pretty-print.c	(working copy)
@@ -86,7 +86,7 @@ dump_profile (profile_count &count)
 {
   char *buf;
   if (!count.initialized_p ())
-    return NULL;
+    return "";
   if (count.ipa_p ())
     buf = xasprintf ("[count: %" PRId64 "]",
 		     count.to_gcov_type ());

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]