This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/AARCH64 1/6] Fix size and pointer different types for ILP32.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]