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]

[PATCH] Fix usage of an uninitialized variable


Simple fix of a warning reported during bootstrap:

../../lto-plugin/lto-plugin.c: In function ‘all_symbols_read_handler’:
../../lto-plugin/lto-plugin.c:673:20: warning: ‘linker_output_str’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   *lto_arg_ptr++ = xstrdup (linker_output_str);

Ready for trunk?
Thanks,
Martin

lto-plugin/ChangeLog:

2016-01-06  Martin Liska  <mliska@suse.cz>

	* lto-plugin.c (all_symbols_read_handler): Assign default
	value to a string variable.
---
 lto-plugin/lto-plugin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 0a6a767..1ed0f08 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -628,7 +628,7 @@ all_symbols_read_handler (void)
   unsigned num_lto_args
     = num_claimed_files + num_offload_files + lto_wrapper_num_args + 2;
   char **lto_argv;
-  const char *linker_output_str;
+  const char *linker_output_str = NULL;
   const char **lto_arg_ptr;
   if (num_claimed_files + num_offload_files == 0)
     return LDPS_OK;
-- 
2.6.3


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