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 <vinc...@vinc17.net> - 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) _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel