tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Ready for Release 0.9.27


From: Vincent Lefevre
Subject: Re: [Tinycc-devel] Ready for Release 0.9.27
Date: Thu, 9 Feb 2017 13:35:31 +0100
User-agent: Mutt/1.7.2-6906-vl-r95471 (2017-01-17)

Hi,

On 2017-02-08 23:09:05 +0000, Thomas Preud'homme wrote:
> On mercredi 8 février 2017 20:15:10 GMT grischka wrote:
> > Anyone else any patches that that 0.9.27 should still have?
> 
> I'd like to fix
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832759 (if it is
> indeed a bug, I haven't checked carefully) but don't wait for me.

The C standard says:

  6.3.1.1 Boolean, characters, and integers

  [...]

  If an int can represent all values of the original type (as
  restricted by the width, for a bit-field), the value is converted
  to an int; otherwise, it is converted to an unsigned int. These are
  called the integer promotions.58) All other types are unchanged by
  the integer promotions.

In my example of my Debian bug report:

  struct { unsigned int a:3; } s = { 1 };

  s.a - 2

The original type (a 3-bit unsigned bit-field) contains the values
from 0 to 7. An int can represent all of them. Thus s.a is converted
to an int, and s.a - 2 gives -1 (as an int).

But according to the test, tcc seems to regard s.a - 2 as
(unsigned int) (-1), i.e. UINT_MAX. However, tcc behaves correctly
on ((unsigned char) 1 - 2), giving -1.

Note that GCC 6.3.0, ICC 15.0.0 and Clang 3.9.1 are correct on this
test.

-- 
Vincent Lefèvre <address@hidden> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



reply via email to

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