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.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages tcc depends on:
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an

Versions of packages tcc recommends:
ii  libc6-dev [libc-dev]        2.3.2.ds1-22 GNU C Library: Development Librari

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to