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

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Thu Mar 29 06:57:29 UTC 2012


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

--- Comment #11 from Ralf Corsepius <ralf.corsepius at rtems.org> 2012-03-29 01:57:29 CDT ---
(In reply to comment #10)
> Just so I understand.
> 
> 1. GCC tests generated warnings because the stdint.h in newlib did not match up
> with what gcc says it needs.

Mostly. GCC generates warnings, when it detects type mismatches. Inside of
GCC's testsuite, these are raised to errors due to the testsuites using
-Werror.

> 2. The solution is to switch to GCC and so the warnings have gone.

If you want to express it this way, yes.

> What about newlib ? Is newlib all ok and passing all its tests with these
> changes across all architectures.
Newlib is supposed to be OK. ATM, I am not aware of any regression.

> If they are the same why change them ?
>
> What was different that caused these warnings ?
Let me try to elaborate:

RTEMS-newlib's stdint.h initially applied checks on GCC's internal types's
_sizes_ to derive POSIX _types_ (int32_t, intptr_t etc.) and POSIX defines
(INT32_C, etc.). E.g. it tries to typedef int32_t to "int" or "long" if the
size of "int" or "long" matches 32 bit, but it doesn't know whether GCC is
using "int" or "long" for its internal int32_t type.  This works, as long as
GCC internal types and newlib's choice are compatible.

However, over the years, GCC was added type-checks (notably fprintf format
checks/-Wformat), which furtherly tightened the constraints on _types_. This
made closer matching of the _types_ being used in typedefs in stdint.h and
GCC's internal _types_ necessary, which had caused newlib's stdint.h to
gradually getting cluttered with further GCC-specific preprocessor magic.

At the same time, GCC had been gradually extended with the capability to
directly provide a stdint.h.

In this context, the test failures Sebastian tripped over, are caused by GCC
having furtherly extended its internal types (In particuliar, they added
__INTPTR_TYPE__) and changed other internal types.

What I am trying now, is to escape this "never-ending" struggle with conflicts
between the POSIX stdint.h types vs. GCC's internal types, by switching to
GCC's stdint.h.


Finally note, the current implementation is only an initial step, I have been
testing by compile-tests (e.g. I compiled all RTEMS multilibs) and some other
tests (I have a testsuite aiming at  stdint types). However, it definitely
needs more testing, as well as does the implementation need improvements.

ATM, my plan is to gradually address these issues, when gradually address the
outstanding issues blocking targets from upgrading to GCC-4.7.0.

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