Package: tcc
Version: 0.9.26~git20120612.ad5f375-6
Severity: normal

TCC doesn't set the FE_INVALID flag on comparison with NAN (<=, >=, <, >),
at least on amd64, e.g. with:

#include <stdio.h>
#include <math.h>
#include <fenv.h>

#pragma STDC FENV_ACCESS ON

int main (void)
{
  double d = NAN;
  volatile double v = NAN;
  int err = 0;

  feclearexcept (FE_INVALID);
  if (d <= 0.0)
    {
      printf ("NAN comparison is wrong (1)\n");
      err = 1;
    }
  if (! fetestexcept(FE_INVALID))
    {
      printf ("The FE_INVALID flag is not set (1)\n");
      err = 1;
    }

  feclearexcept (FE_INVALID);
  if (v <= 0.0)
    {
      printf ("NAN comparison is wrong (2)\n");
      err = 1;
    }
  if (! fetestexcept(FE_INVALID))
    {
      printf ("The FE_INVALID flag is not set (2)\n");
      err = 1;
    }

  feclearexcept (FE_INVALID);
  v <= 0.0;
  if (! fetestexcept(FE_INVALID))
    {
      printf ("The FE_INVALID flag is not set (3)\n");
      err = 1;
    }

  return err;
}

I get:

$ tcc nancmp.c -o nancmp -lm
$ ./nancmp
The FE_INVALID flag is not set (1)
The FE_INVALID flag is not set (2)
The FE_INVALID flag is not set (3)

Like GCC (which is affected by the same bug), the problem is that
tcc uses ucomisd instead of comisd for <=, >=, <, >.

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages tcc depends on:
ii  dpkg          1.16.9
ii  install-info  4.13a.dfsg.1-10
ii  libc6         2.13-38

Versions of packages tcc recommends:
ii  libc6-dev [libc-dev]  2.13-38

tcc suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to