[ltrace-commits] 01/01: Initialize libsym early in trace.c to help the compiler.

Petr Machata pmachata-guest at moszumanska.debian.org
Fri Jan 10 01:37:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

pmachata-guest pushed a commit to branch master
in repository ltrace.

commit b882ba7bd0840db234eb84c27665da4b3f4b42b8
Author: Mark Wielaard <mjw at redhat.com>
Date:   Thu Jan 9 22:56:35 2014 +0100

    Initialize libsym early in trace.c to help the compiler.
    
    GCC 4.4.7 isn't smart enough to realize own_libsym will always be zero
    when it sees the goto done which might jump over the initialization of
    libsym. And so will produce a warning like:
    
    cc1: warnings being treated as errors
    trace.c: In function ‘ifunc_ret_hit’:
    trace.c:1433: error: ‘libsym’ may be used uninitialized in this function
---
 sysdeps/linux-gnu/trace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index e648b8f..0abb545 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -1390,6 +1390,7 @@ ifunc_ret_hit(struct breakpoint *bp, struct process *proc)
 
 	struct breakpoint *nbp = NULL;
 	int own_libsym = 0;
+	struct library_symbol *libsym = NULL;
 
 	struct value value;
 	value_init(&value, proc, NULL, type_get_voidptr(), 0);
@@ -1430,8 +1431,7 @@ ifunc_ret_hit(struct breakpoint *bp, struct process *proc)
 
 	/* Look if we already have a symbol with this address.
 	 * Otherwise create a new one.  */
-	struct library_symbol *libsym
-		= library_each_symbol(lib, NULL, libsym_at_address, &u.a);
+	libsym = library_each_symbol(lib, NULL, libsym_at_address, &u.a);
 	if (libsym == NULL) {
 		libsym = malloc(sizeof *libsym);
 		char *name = strdup(bp->os.ret_libsym->name);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git



More information about the ltrace-commits mailing list