It appears (see details in issue #867) that one of the optimizations in Gcc 4.8.4's "-O1" miscompiles code which uses a function called "round()" to call "lround()" instead. This causes our lround() function (which calls our round()) to go into a silly infinite loop.
Sadly, it seems that none of the specific "-fno-*" options to disable specific optimizations avoid this optimization. So the workaround in this patch is to use -O0 on the affected source files - those which implement the various {l,ll}round{,f,l} functions. This will slow these functions by a little bit, but hopefully they are not heavily used by performance- minded applications, anyway. Fixes #867. Signed-off-by: Nadav Har'El <n...@scylladb.com> --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 5133d8e..ba84338 100644 --- a/Makefile +++ b/Makefile @@ -1283,6 +1283,20 @@ musl += math/trunc.o musl += math/truncf.o musl += math/truncl.o +# Issue #867: Gcc 4.8.4 has a bug where it optimizes the trivial round- +# related functions incorrectly - it appears to convert calls to any +# function called round() to calls to a function called lround() - +# and similarly for roundf() and roundl(). +# None of the specific "-fno-*" options disable this buggy optimization, +# unfortunately. The simplest workaround is to just disable optimization +# for the affected files. +$(out)/musl/src/math/lround.o: conf-opt := $(conf-opt) -O0 +$(out)/musl/src/math/lroundf.o: conf-opt := $(conf-opt) -O0 +$(out)/musl/src/math/lroundl.o: conf-opt := $(conf-opt) -O0 +$(out)/musl/src/math/llround.o: conf-opt := $(conf-opt) -O0 +$(out)/musl/src/math/llroundf.o: conf-opt := $(conf-opt) -O0 +$(out)/musl/src/math/llroundl.o: conf-opt := $(conf-opt) -O0 + musl += misc/a64l.o libc += misc/basename.o musl += misc/dirname.o -- 2.9.3 -- 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. For more options, visit https://groups.google.com/d/optout.