[Bug 2038] C99 integer type mismatch in GCC and Newlib

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Mar 27 08:08:49 UTC 2012


https://www.rtems.org/bugzilla/show_bug.cgi?id=2038

--- Comment #4 from Sebastian Huber <sebastian.huber at embedded-brains.de> 2012-03-27 03:08:49 CDT ---
I think the INTPTR_MIN, INTPTR_MAX, and UINTPTR_MAX are not according to the
standard

http://pubs.opengroup.org/onlinepubs/007904975/basedefs/stdint.h.html

We have this:

 #if defined(__SIZEOF_POINTER__)
 #if __SIZEOF_POINTER__ == 8
 #define INTPTR_MAX INT64_MAX
 #define INTPTR_MIN INT64_MIN
 #define UINTPTR_MAX UINT64_MAX
 #elif __SIZEOF_POINTER__ == 4
 #define INTPTR_MAX INT32_MAX
 #define INTPTR_MIN INT32_MIN
 #define UINTPTR_MAX UINT32_MAX
 #elif __SIZEOF_POINTER__ == 2
 #define INTPTR_MAX INT16_MAX
 #define INTPTR_MIN INT16_MIN
 #define UINTPTR_MAX UINT16_MAX

But this should be independent of the actual pointer width:

Limits of integer types capable of holding object pointers

    *

      Minimum value of pointer-holding signed integer type:

      {INTPTR_MIN}
          -(2^15 -1)

    *

      Maximum value of pointer-holding signed integer type:

      {INTPTR_MAX}
          2^15 -1

    *

      Maximum value of pointer-holding unsigned integer type:

      {UINTPTR_MAX}
          2^16 -1

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list