On Tue, Dec 10, 2013 at 3:23 AM, Marcus Shawcroft <marcus.shawcr...@gmail.com> wrote: > On 3 December 2013 21:24, Andrew Pinski <pins...@gmail.com> wrote: >> >> While compiling some programs, GCC and glibc (and newlib)'s definitions of >> size_t >> were not agreeing and causing format warnings to happen. The simple >> testcase for this is: >> #include <stdio.h> >> #include <stdint.h> >> >> int main(void) >> { >> ssize_t t = 0x1; >> printf("%zd\n", t); >> return 0; >> } > > Hi Andrew, > > The PCS IHI0056C defines SIZE_TYPE as 'unsigned long' for both ILP32 > and LP64 and PTRDIFF_TYPE as "signed long" for both ILP32 and LP64. > This seems like a sane choice to me. > > Trying to recreate the failure with the test fragment above doesn't > given a warning: > > $ aarch64-none-elf-gcc -Wall -mabi=ilp32 test-size_t.c -specs=rdimon.specs > $ aarch64-none-linux-gnu-gcc -Wall -mabi=ilp32 test-size_t.c -c > $ > > ..what am I doing differently to your test run?
I found out it was a bug in glibc where it defines __SSIZE_T_TYPE to __SWORD_TYPE (int for ilp32 and long for lp64) rather than __SLONGWORD_TYPE (long always). I have fix for when I submit the glibc patches. Thanks, Andrew Pinski > > Cheers > /Marcus