Date: Sat, 21 Nov 2015 21:11:22 +0100 From: u-uy74@...ey.se To: musl@...ts.openwall.com Subject: Re: for information, gcc-4.2.3 miscompiles musl math On Sat, Nov 21, 2015 at 02:25:48PM -0500, Rich Felker wrote: > > like "sin(8.000000) = 21.709544". > > Looks like the argument reduction logic has changed in a way > > which is not compatible with gcc-4.2.3. > > Are you using configure or a hand-written config.mak? configure sets > up a big hammer, -ffloat-store, when -fexcess-precision=standard is > not supported (i.e. on old gcc), which hopefully suffices to make this > code work, but it's possible it doesn't always do the job. I was using configure. Here are the compilation flags which were used while building with 4.2.3: (the command line has been run through "fmt" here) gcc -march=i486 -std=c99 -nostdinc -ffreestanding -ffloat-store -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal -I./include -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486 -mtune=generic -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector -c -o src/math/sin.o src/math/sin.c Yes, -ffloat-store is present but apparently did not suffice. > > I do not notice any problems while compiling musl with gcc-5.2, nor > > have a compelling reason to insist on using gcc-4.2.3 (somebody else > > might have though, gcc-4.2.3 is the last one under gpl 2). > > I thought 4.2.1 was the last. I think Wikipedia says so as well but The Source is the truth. It is 4.2.3 and nothing else. It is also in fact remarkably better than 4.2.1 and I could build with it mostly everything I needed, modulo features newer than the compiler. > If you don't want to look into it further yourself I'll see if someone > else interested in old toolchains can or try to get around to it > myself. I really don't want to introduce more hacks for these broken > compilers though. If people really still want to use them, we should It was not my intention to fix, only to warn. On the other side, I have a convenient environment to play with multiple versions of everything, I can run a test if you will want me to. > probably just find a cheap way to fix the compiler, like patching it > not to perform any optimizations whatsoever on floating point > expressions. This would surely be cleaner from the musl perspective, but also a much more expensive procedure (rebuild the compiler) than e.g. patching musl. Anyway, probably a fix is not worth spending any time on, until somebody explicitly asks for support of 4.2.3. Nevertheless, thanks for taking this into consideration Rich. Rune
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.