Following testcase returns wrong result on x86_64-pc-linux-gnu due to the
mismatch of return type from soft-fp/getf2.c (and letf2.c). The return type
from soft-fp functions is int (SImode) but the test in prepare_float_lib_cmp()
/optabs.c/ that test the returned value expands to word_mode (DImode on 64bit
targets).

On 32bit targets, word_mode is also 32 bit and everything is OK.

--cut here--
void abort(void);

int test_lt(__float128 x, __float128 y)
{
  return x < y;
}

int test_gt (__float128 x, __float128 y)
{
  return x > y;
}

int main()
{
  __float128 a = 0.0;
  __float128 b = 1.0;

  int r;

  r = test_lt (a, b);
  if (r != ((double) a < (double) b))
    abort();

  r = test_gt (a, b);
  if (r != ((double) a > (double) b))
    abort();

  return 0;
}
--cut here--

BTW: This problem was also spotted at
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg02129.html.


-- 
           Summary: Wrong comparison results for __float128 operands
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ubizjak at gmail dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32268

Reply via email to