|
From: | Christian JULLIEN |
Subject: | [Tinycc-devel] RE : tcc doesn't set the inexact flag on inexact compile-time int-to-float conversion |
Date: | Mon, 22 Apr 2013 16:13:14 +0200 (CEST) |
----- Message d'origine -----
De : "Vincent Lefevre" <address@hidden>
Date lun. 22/04/2013 15:58 (GMT +02:00)
À : "address@hidden" <address@hidden>
Objet : [Tinycc-devel] tcc doesn't set the inexact flag on inexact compile-time int-to-float conversion
tcc doesn't set the inexact flag on inexact compile-time int-to-float
conversion:
#include <stdio.h>
#include <fenv.h>
#pragma STDC FENV_ACCESS ON
void test1 (void)
{
volatile float c;
c = 0x7fffffbf;
printf ("c = %a, inexact = %d\n", c, fetestexcept (FE_INEXACT));
}
void test2 (void)
{
volatile float c;
volatile int i = 0x7fffffbf;
c = i;
printf ("c = %a, inexact = %d\n", c, fetestexcept (FE_INEXACT));
}
int main (void)
{
test1 ();
test2 ();
return 0;
}
With tin 0.9.25 under Linux/x86_64 (Debian):
$ tcc -Wall -O2 conv-int-flt-inex.c -o conv-int-flt-inex -lm
$ ./conv-int-flt-inex
c = 0x1.fffffep+30, inexact = 0
c = 0x1.fffffep+30, inexact = 32
FYI, GCC has the same problem:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57029
--
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |