SourceForge has been redesigned. Learn more.

#422 Issues with stdint.h header


GCC-4.5 has good coverage of the C99 types in stdint.h, and it currently has three failures on mingw32 (gcc.dg/c99-stdint-{1,5,6}.c), due to two issues:

1. int_fast8_t is defined as "char" instead of being "signed char" (as are int_least8_t and int8_t); this is potentially troublesome if one plays with char signedness; also, this is contrary to all headers I could find (except in those that are copied from the mingw32 one!)

2. the INT8_C, INT16_C, INT32_C, UINT8_C, UINT16_C and UINT32_C macros don't have the right type; they should have simple "int" type, except for UINT32_C which should have "unsigned" type; some explaination of why this is so can be found here by GCC's C99 "resident expert" (

With the attached patch, all GCC C99 tests pass.


  • FX

    FX - 2009-07-30

    Patch for the stdint.h header

  • Chris Sutcliffe

    Chris Sutcliffe - 2009-07-31
    • labels: 310394 --> MinGW runtime
    • assigned_to: nobody --> ir0nh34d
  • Chris Sutcliffe

    Chris Sutcliffe - 2009-07-31

    I'm curious, for the second part of the patch, why have the UINT* macros lost their unsigned attribute?

    For example, looking at the link you specified:

    /** Macros for minimum-width integer constant expressions */
    #define INT8_C(x) x
    +#if __STDINT_EXP(INT_MAX) > 0x7f
    +#define UINT8_C(x) x
    #define UINT8_C(x) x##U

    in your patch, there is no check to see what the INT_MAX is, you simply set it to return val. Is this correct?

  • Danny Smith

    Danny Smith - 2009-07-31

    I think your changes have already been incorporated into CVS as of
    2009-04-11 Danny Smith <>

    \* include/stdint.h \(int\_fast8\_t\): Specify as signed char.
    \(INT8\_C, UINT8\_C, INT16\_C, UINT16\_C\): Simplify: just allow promotion to int.
    \(INT32\_C, UINT32\_C\): Remove 'L' type specifier on constant.
  • FX

    FX - 2009-07-31
    • status: open --> closed
  • FX

    FX - 2009-07-31

    Yep, the CVS version is exactly as I proposed in my patch, sorry for that.