This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/2841] New: stdint.h misdefines UINT8_C and UINT16_C to append U


C99 7.18.4.1 (as revised by ISO/IEC 9899:1999/Cor.1:2001) says that
UINT8_C and UINT16_C return values corresponding to uint_least8_t and
uint_least16_t.  They therefore must promote the same way.  But glibc
appends 'U', which causes UINT8_C and UINT16_C to promote to 'unsigned
int', not 'int'.  Here is a test program illustrating the bug: it
strictly conforms to the C99 but GCC + glibc reject it.  I'll attach
the obvious patch.

#include <stdint.h>
char test1[(-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1];
char test2[(-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1];

-- 
           Summary: stdint.h misdefines UINT8_C and UINT16_C to append U
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: eggert at gnu dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2841

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]