This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] newlib-stdint.h: Remove 32 bit longs
- From: Andy Ross <andrew dot j dot ross at intel dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Joel Sherrill <joel dot sherrill at oarcorp dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "<newlib at sourceware dot org>" <newlib at sourceware dot org>
- Date: Mon, 22 Aug 2016 09:42:56 -0700
- Subject: Re: [PATCH] newlib-stdint.h: Remove 32 bit longs
- Authentication-results: sourceware.org; auth=none
- References: <e7907443-eea0-87b5-87ba-fc34aa90c387@intel.com> <CA+=Sn1nAj0n2DJgwCUY434qxq-09zw62=+xt1JLbzS9dHo46jA@mail.gmail.com> <E14AB9B3-7DD2-47AF-A6E0-4A48EE7EC068@oarcorp.com> <17f8e287-d84c-ba2e-9a96-99c8eb22ab69@intel.com> <CA+=Sn1=dQCp33sONxhom+SmJsUG7tM4oAK20tP1upnRgrLzvmA@mail.gmail.com>
Andrew Pinski wrote:
> Why do you think the above code does not have a bug in it? int32_t
> is long and changing it now is changing the ABI (especially for
> C++).
I don't follow. There's no change to the ABI, the generated code is
identical in all cases. Can you explain what you mean?
The problem here is that on 32 bit platforms (and *only* on 32 bit
platforms), gcc picks "long" for a 32 bit type in a way that confuses
newlib into using it for int32_t in a way that is technically legal,
but incompatible with the way the rest of the world (including newlib
itself when building with other compilers on the same platform!)
works.
So obvious code like I posted, which works everywhere, generates
warnings with a newlib cross compiler. I would like to see that
fixed.
Andy