[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Fwd: Bug#322913: tcc: _Bool exists but doesn't comply wit
From: |
Romain Francoise |
Subject: |
[Tinycc-devel] Fwd: Bug#322913: tcc: _Bool exists but doesn't comply with C99 |
Date: |
Sun, 28 Aug 2005 15:57:13 +0200 |
Hi,
A Debian user reported this bug about C99 compliance in TCC.
-------------------- Start of forwarded message --------------------
From: Hrvoje Niksic <address@hidden>
Subject: Bug#322913: tcc: _Bool exists but doesn't comply with C99
To: Debian Bug Tracking System <address@hidden>
Date: Sat, 13 Aug 2005 16:02:18 +0200
Package: tcc
Version: 0.9.23-1
Severity: normal
Tcc doesn't correctly implement casts from floating point types to _Bool.
According to C99, such casts must return true for all numbers except 0:
When any scalar value is converted to _Bool, the result is 0 if the value
compares equal to 0; otherwise, the result is 1.
This means that (_Bool) 0.1 must be 1; with tcc it's 0. The following
trivial program can be used to test this:
#include <stdio.h>
int
main (void)
{
printf ("%d\n", (_Bool) 0.1);
return 0;
}
The program prints 1 under Gcc (and other C99-compliant compilers I tested
it with, such as Sun's cc) and 0 under Tcc. I know that Tcc doesn't aim for
C99 conformance, but it's confusing that it implements the _Bool type which
comes from C99, but not the associated semantics.
-------------------- End of forwarded message --------------------
Thanks,
--
,''`.
: :' : Romain Francoise <address@hidden>
`. `' http://people.debian.org/~rfrancoise/
`-
- [Tinycc-devel] Fwd: Bug#322913: tcc: _Bool exists but doesn't comply with C99,
Romain Francoise <=