tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Fwd: Bug#698351: tcc: FE_INVALID flag not set on comparis


From: Thomas Preud'homme
Subject: [Tinycc-devel] Fwd: Bug#698351: tcc: FE_INVALID flag not set on comparison with NAN (unordered)
Date: Thu, 17 Jan 2013 15:57:50 +0100
User-agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )

Hi there,

I've just received this bug report in Debian. I don't know about this flag but 
if even gcc does the mistake, I think we can safely delay the fix for after the 
release, unless it's an easy fix. The bug report suggest there is just an 
instruction to change and that could be done easily I guess but as I said I 
don't know anything about this flag (first time I hear about it).

Best regards,

Thomas Preud'homme
--- Begin Message --- Subject: Bug#698351: tcc: FE_INVALID flag not set on comparison with NAN (unordered) Date: Thu, 17 Jan 2013 15:40:31 +0100 User-agent: Mutt/1.5.21-6288-vl-r57386 (2013-01-17)
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

--- End Message ---

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]