[Bug runtime/32695] The static array size of STAP_KPROBE_PROBE_STR_module cause -Werror=string-compare with GCC-15

wcohen at redhat dot com sourceware-bugzilla@sourceware.org
Fri Feb 14 17:15:48 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=32695

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from William Cohen <wcohen at redhat dot com> ---
Addressed with the following commit.

commit de7cbed94521f60de8cc1f90128396528542a111 (HEAD -> master, origin/master,
origin/HEAD)
Author: William Cohen <wcohen@redhat.com>
Date:   Fri Feb 14 12:03:29 2025 -0500

    PR32695: Disable GCC15 static checks for strcmp in runtime/linux/kprobes.c

    The GCC15 compiler is more aggressive in its static checking of string
    operations and flags cases that always return a particular result as an
    error.  This causes the systemtap kernel module build to fail due to a
    strcmp in runtime/linux/kprobes.c for some instrumentation.
    Added a pragma to disable the compiler check for that area of code.
    The GCC statically determined result of the strcmp is correct and
    not an error.

diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c
index 9ae5565e3..09d5c7a31 100644
--- a/runtime/linux/kprobes.c
+++ b/runtime/linux/kprobes.c
@@ -800,6 +800,8 @@ stapkp_init(struct stap_kprobe_probe *probes,
       if (rc == 1) // failed to relocate addr?
          continue; // don't fuss about it, module probably not loaded

+      // PR32695 gcc might statically determine the strcmp will nevery match
+#pragma GCC diagnostic ignored "-Wstring-compare"
       // NB: We keep going even if a probe failed to register (PR6749). We
only
       // warn about it if it wasn't optional and isn't in a module.
       if (rc && !skp->optional_p

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Systemtap mailing list