Blob Blame History Raw
commit 97a9ceb2a294ee3218987daf84a5ab3d9d361e27
Author: Martin Cermak <mcermak@redhat.com>
Date:   Thu Jun 14 14:35:26 2018 +0200

    Improve the foreach_limit(2).exp test results.
    
    Without this update, one can observe following issue with rhel7
    powerpc kernels:
    
    =======
     # stap -p4 testsuite/systemtap.maps/foreach_limit.stp
     ...
     /usr/local/share/systemtap/runtime/map.c:275:26: error: ‘a’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
        struct mlist_head *c, *a, *last, *tmp;
                               ^
     /usr/local/share/systemtap/runtime/map.c:275:26: error: ‘a’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     cc1: all warnings being treated as errors
    =======
    
    This problem turns out to start happening after the powerpc kernel
    build system started using -O3 instead of -O2 as one can see in
    http://vault.centos.org/7.5.1804/os/Source/SPackages/kernel-3.10.0-862.el7.src.rpm
    
    =======
     # powerpc is compiled with -O3, via specfile rpmbuild -- see rhbz1051067.
     # we need to keep consistency here, however, for out of tree kmod builds --
     # see rhbz1431029 for reference
     ifeq ($(SRCARCH), powerpc)
     KBUILD_CFLAGS   += -O3
     else
     KBUILD_CFLAGS   += -O2
     endif
    =======
    
    Reverting this change (using -O2 instead of -O3) works the problem around
    as well as this systemtap-side update.  For more details, see rhbz1591267.

diff --git a/runtime/map.c b/runtime/map.c
index 5caf739..ef91456 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -272,7 +272,7 @@ static void _stp_map_sortn(MAP map, int n, int keynum, int dir,
 		_stp_map_sort(map, keynum, dir, get_key);
 	} else {
 		struct mlist_head *head = &map->head;
-		struct mlist_head *c, *a, *last, *tmp;
+		struct mlist_head *c, *a = 0, *last, *tmp;
 		int num, swaps = 1;
 
 		if (mlist_empty(head))