[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/7] tools/xenalyze: Work around GCC-15 -Werror=nonnull false positive



Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Michal Orzel <michal.orzel@xxxxxxx>
CC: Doug Goldstein <cardoe@xxxxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
CC: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>

I don't particularly like this, but I see no better option.  It's clearly some
kind of VRA failure, yet we don't see it with GCC 15 in other distros.  I
suspect that Musl (as opposed to glibc) might be relevant, and perhaps even as
simple as not realising that error() is terminal for a non-zero input.
---
 tools/xentrace/xenalyze.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 876d59d42ca5..cec1354cf779 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -3789,6 +3789,17 @@ void update_io_address(struct io_address ** list, 
unsigned int pa, int dir,
             error(ERR_SYSTEM, NULL);
         }
 
+        /*
+         * GCC 15.2 in Alpine Linux 3.24 fails with -Werror=nonnull,
+         * complaining that we're calling bzero(NULL, 128).
+         *
+         * This looks to be a false positive as p being NULL will never reach
+         * here as the error() above will have called exit().
+         *
+         * Work around this by hiding the NULL-ness of p from the compiler.
+         */
+        asm ("" : "+r" (p));
+
         bzero(p, sizeof(*p));
 
         p->pa=pa;
-- 
2.39.5




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.