This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH/AARCH64 1/6] Fix size and pointer different types for ILP32.
- From: Andrew Pinski <pinskia at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- To: gcc-patches at gcc dot gnu dot org
- Cc: Andrew Pinski <apinski at cavium dot com>
- Date: Tue, 3 Dec 2013 13:24:47 -0800
- Subject: [PATCH/AARCH64 1/6] Fix size and pointer different types for ILP32.
- Authentication-results: sourceware.org; auth=none
- References: <1386105892-2379-1-git-send-email-apinski at cavium dot com>
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