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

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Mar 27 09:04:25 UTC 2012


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

--- Comment #5 from Sebastian Huber <sebastian.huber at embedded-brains.de> 2012-03-27 04:04:25 CDT ---
Sorry, forget my last comment.

The problem is this code (from pre-processed c99-stdint-1.c):

[...]
typedef int intptr_t;
[...]
void
test_ptr (void)
{

  do { intptr_t a; int b[(intptr_t)-1 < 0 ? 1 : -1]; } while (0); do {
__typeof__(((-2147483647L-1))) a; __typeof__((intptr_t)0 + 0) *b = &a; } while
(0); do { __typeof__((2147483647L)) a; __typeof__((intptr_t)0 + 0) *b = &a; }
while (0); do { int a[(((((-2147483647L-1))) == -((2147483647L))-1 &&
(((2147483647L)) & 1) && (((((2147483647L)) >> 1) + 1) >> (sizeof(intptr_t) * 8
- 2)) == 1) && ((-2147483647L-1)) <= (-0x7fff) && (2147483647L) >= (0x7fff)) ?
1 : -1]; } while (0);


  do { uintptr_t a; int b[(uintptr_t)-1 < 0 ? -1 : 1]; } while (0); do {
__typeof__((4294967295UL)) a; __typeof__((uintptr_t)0 + 0) *b = &a; } while
(0); do { int a[((((4294967295UL)) == (uintptr_t)-1) && (4294967295UL) >=
(0xffffU)) ? 1 : -1]; } while (0);

}
[...]

The error is in:

do { __typeof__(((-2147483647L-1))) a; __typeof__((intptr_t)0 + 0) *b = &a; }
while (0);

We have INTPTR_MIN of type long int and intptr_t of type int.

-- 
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