This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] misc: Add twalk_r function
* Joseph Myers:
> I'm seeing (at least with GCC 8):
>
> tst-tsearch.c: In function 'walk_tree.constprop':
> tst-tsearch.c:231:3: error: 'first_list_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> for (size_t i = 0; i < first_list_size && i < walk_trace_size (&walk_trace);
> ^~~
Huh. Sorry about that. I don't get this error, with a GCC 8.3-based
compiler.
It's arguably a test bug. Does this patch fix it for you?
diff --git a/misc/tst-tsearch.c b/misc/tst-tsearch.c
index 9a570dd6c9..07d13622b1 100644
--- a/misc/tst-tsearch.c
+++ b/misc/tst-tsearch.c
@@ -223,6 +223,7 @@ walk_tree (void *root, int expected_count)
size_t first_list_size;
struct walk_trace_element *first_list
= walk_trace_finalize (&walk_trace, &first_list_size);
+ TEST_VERIFY_EXIT (first_list != NULL);
walk_tree_with (root, expected_count, twalk_with_twalk_r);
It assumes that the tree is not empty, but I think this is true in this
test.
Thanks,
Florian