From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

libc: fix build of qsort() and qsort_r()

Musl's implementation of qsort() and qsort_r() (in newer musl, these
are the same function, but we copied old versions so have two copies
of similar code) uses code that confuses gcc 12.1.1 into thinking
that a temporary function variable ("tmp" in cycle()) is saved on
a non-temporary array. The code really does this saving, but the
position saved will not be read again after the function returns.

So to avoid these false alarms we add the -Wno-dangling-pointer
option when compiling those two files.

This is one of the fixes needed to build on Fedora 36 (refs #1198).

Signed-off-by: Nadav Har'El <n...@scylladb.com>

---
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1698,7 +1698,9 @@ musl += stdlib/ldiv.o
 musl += stdlib/llabs.o
 musl += stdlib/lldiv.o
 musl += stdlib/qsort.o
+$(out)/musl/src/stdlib/qsort.o: COMMON += -Wno-dangling-pointer
 libc += stdlib/qsort_r.o
+$(out)/libc/stdlib/qsort_r.o: COMMON += -Wno-dangling-pointer
 libc += stdlib/strtol.o
 libc += stdlib/strtod.o
 libc += stdlib/wcstol.o

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000ee326405e24c4f4f%40google.com.

Reply via email to