Port-arm archive

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

Re: Softfloat miscompiled by gcc 4.5.x

(2012/11/13 19:52), Masanobu SAITOH wrote:
(2012/11/13 19:28), Masanobu SAITOH wrote:
(2012/11/13 19:24), Masanobu SAITOH wrote:
(2012/10/01 17:08), Martin Husemann wrote:
On Mon, Oct 01, 2012 at 07:45:01AM +0100, David Laight wrote:
I don't call that a fix.

Neither do I.

There is either a bug in gcc (which will affect other code), or bugs
in the softfloat code itself - which will appear again later.

Yes - my bet is on the former for now.

  I debugged this.

     The problem occurs with -O1 -ftree-vrp.

     The problem doesn't occur with -O2 -fno-tree-vrp.

     The problem doesn't occur when SOFTFLOAT_BITS=64
     (Note that only arm and emips set it with 64)

s/set it with 64/set it with 32/

  How about COPTS.softfloat.c+=-fno-tree-vrp?

The ATF test result in /usr/tests/lib/libm was as follows (netbsd-6):

Summary for 20 test programs:
     311 passed test cases.
     0 failed test cases.      <======== Changed from 16 to 0
     4 expected failed test cases.
     5 skipped test cases.

  I tried to fix tree-vrp.c but I knew it's little hard for me to fix :-(

Shouldn't be too hard to isolate 1 buggy file and work out exactly
where it goes wrong.
I'd guess a 'strict aliasing' issue....

For someone with enough arm asm fu - probably. The differences in the
generated asm are "not small" though, and unfortunately I don't have time
to look at details right now. Volunteers welcome...


Some people asked me about my analysis and testcase, so I write about it.

  ceil(-Inf) desn't return -INF on arm. It returns 0. This test is included
in tests/lib/libm/t_ceil.

  In lib/libm/src/s_ceil.c:

ceil(double x)


        } else if (jj0>51) {
            if(jj0==0x400) return x+x;  /* inf or NaN */
            else return x;              /* x is integral */

x+x calls adddf3 and it returns 0 even if x is -INF.

                SAITOH Masanobu (msaitoh%execsw.org@localhost

Home | Main Index | Thread Index | Old Index