[PATCH/AARCH64 1/6] Fix size and pointer different types for ILP32.
Andrew Pinski
pinskia@gmail.com
Tue Dec 3 21:25:00 GMT 2013
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;
}
----- CUT -----
OK? Built and tested for aarch64-elf without any regressions.
Thanks,
Andrew Pinski
* config/aarch64/aarch64.h (SIZE_TYPE): Set to unsigned int for ILP32.
(PTRDIFF_TYPE): Set to int for ILP32.
---
gcc/ChangeLog | 5 +++++
gcc/config/aarch64/aarch64.h | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
iff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index cead022..65d226d 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -144,9 +144,9 @@
/* Using long long breaks -ansi and -std=c90, so these will need to be
made conditional for an LLP64 ABI. */
-#define SIZE_TYPE "long unsigned int"
+#define SIZE_TYPE (TARGET_ILP32 ? "unsigned int" : "long unsigned int")
-#define PTRDIFF_TYPE "long int"
+#define PTRDIFF_TYPE (TARGET_ILP32 ? "int" : "long int")
#define PCC_BITFIELD_TYPE_MATTERS 1
--
1.7.2.5
More information about the Gcc-patches
mailing list