From 55cbf82427f065c3a97c2216e30c4acc8e246ac0 Mon Sep 17 00:00:00 2001 From: Ziemowit Laski Date: Thu, 29 Jan 2004 03:14:35 +0000 Subject: [PATCH] Fix LP64 failures. * objc.dg/proto-qual-1.m (ROUND, aligned_sizeof): New. (scan_initial, main): Use aligned_sizeof instead of sizeof. From-SVN: r76842 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/objc.dg/proto-qual-1.m | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d5cbccb7442..482ea7a0184 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-01-28 Ziemowit Laski + + * objc.dg/proto-qual-1.m (ROUND, aligned_sizeof): New. + (scan_initial, main): Use aligned_sizeof instead of sizeof. + 2004-01-28 Mark Mitchell PR c++/13791 diff --git a/gcc/testsuite/objc.dg/proto-qual-1.m b/gcc/testsuite/objc.dg/proto-qual-1.m index 6ae12909380..0f1c3102d27 100644 --- a/gcc/testsuite/objc.dg/proto-qual-1.m +++ b/gcc/testsuite/objc.dg/proto-qual-1.m @@ -8,6 +8,10 @@ #include #endif +/* The encoded parameter sizes will be rounded up to match pointer alignment. */ +#define ROUND(s,a) (a * ((s + a - 1) / a)) +#define aligned_sizeof(T) ROUND(sizeof(T),__alignof(void *)) + extern int sscanf(const char *str, const char *format, ...); extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() @@ -34,15 +38,15 @@ static void scan_initial(const char *pattern) { totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1; sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3, &offs4, &offs5, &offs6, &offs7); - CHECK_IF(!offs0 && offs1 == sizeof(id) && offs2 == offs1 + sizeof(SEL) && totsize >= offs2); + CHECK_IF(!offs0 && offs1 == aligned_sizeof(id) && offs2 == offs1 + aligned_sizeof(SEL) && totsize >= offs2); } int main(void) { meth = [proto descriptionForInstanceMethod: @selector(address:with:)]; scan_initial("O@%u@%u:%uNR@%uo^^S%u"); - CHECK_IF(offs3 == offs2 + sizeof(id) && totsize == offs3 + sizeof(unsigned)); + CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned)); meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)]; scan_initial("Vv%u@%u:%uOo@%un^*%u"); - CHECK_IF(offs3 == offs2 + sizeof(id) && totsize == offs3 + sizeof(char **)); + CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **)); return 0; } -- 2.30.2