From 30235ede1a1a99f5a99c257c878a1aab6a41de5a Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 11 Apr 2012 17:58:01 +0000 Subject: [PATCH] c99-const-expr-9.c (old_offsetof): Insert a cast to __UINTPTR_TYPE__. * gcc.dg/c99-const-expr-9.c (old_offsetof): Insert a cast to __UINTPTR_TYPE__. * gcc.c-torture/execute/pr15296.c (intptr_t): Likewise, with __INTPTR_TYPE__. * gcc.dg/pr14092-1.c (intptr_t): Likewise. * gcc.dg/tree-ssa/foldcast-1.c (ssize_t): Likewise. * gcc.dg/c90-const-expr-6.c (intptr_t): New typedef to replace ... (ptrdiff_t): ... this. All uses changed. * gcc.dg/c99-const-expr-6.c (intptr_t, ptrdiff_t): Likewise. * gcc.dg/torture/pta-escape-1.c (foo): Change arg type to __INTPTR_TYPE__. (main): Cast argument to __INTPTR_TYPE__. * gcc.dg/20041106-1.c (main): Cast to __UINTPTR_TYPE__ rather than size_t. * gcc.dg/mallign.c (main): Likewise. * gcc.dg/pr38700.c (foo): Likewise. * gcc.dg/long-long-cst1.c (t): Likewise. * gcc.dg/c99-const-expr-10.c (p, q, f, h, h2): Likewise. * gcc.dg/array-10.c (c0, c1, c2, c3, c4, c5): Likewise. * gcc.dg/pointer-arith-10.c (foo): Likewise. * gcc.dg/pr25682.c (d, foo): Likewise. * gcc.dg/format/cast-1.c (f): Likewise. * gcc.dg/c90-const-expr-10.c * gcc.dg/pr41551.c (uintptr_t): New typedef, replacing... (size_t): ...this. All uses changed. * gcc.c-torture/execute/pr22098-1.c (uintptr_t): Likewise. * gcc.c-torture/execute/pr22098-2.c (uintptr_t): Likewise. * gcc.c-torture/execute/pr22098-3.c (uintptr_t): Likewise. * gcc.dg/pr34856.c (uintptr_t): Likewise. * gcc.dg/sequence-pt-1.c: Likewise. * gcc.dg/c90-const-expr-9.c (uintptr_t): Likewise. * gcc.dg/max-1.c (intptr_t): Likewise, replacing ssize_t. * gcc.dg/pr39074.c (intptr_t): Define using __INTPTR_TYPE__. * gcc.dg/pr30744-1.c (my_intptr_t): New typedef. Replace all uses of ptrdiff_t with it. * gcc.dg/inline-23.c (my_intptr_t): Likewise. * gcc.dg/pr37561.c (p): Use __INTPTR_TYPE__. * gcc.dg/vla-11.c (foo11b): Use __UINTPTR_TYPE__. From-SVN: r186347 --- gcc/testsuite/ChangeLog | 41 +++++++++++++++++++++++++ gcc/testsuite/gcc.c-torture/execute/pr15296.c | 2 +- gcc/testsuite/gcc.c-torture/execute/pr22098-1.c | 6 ++-- gcc/testsuite/gcc.c-torture/execute/pr22098-2.c | 6 ++-- gcc/testsuite/gcc.c-torture/execute/pr22098-3.c | 6 ++-- gcc/testsuite/gcc.dg/20041106-1.c | 2 +- gcc/testsuite/gcc.dg/array-10.c | 12 ++++---- gcc/testsuite/gcc.dg/c90-const-expr-6.c | 8 ++--- gcc/testsuite/gcc.dg/c90-const-expr-9.c | 3 +- gcc/testsuite/gcc.dg/c99-const-expr-6.c | 4 +-- gcc/testsuite/gcc.dg/c99-const-expr-9.c | 2 +- gcc/testsuite/gcc.dg/format/cast-1.c | 2 +- gcc/testsuite/gcc.dg/inline-23.c | 7 +++-- gcc/testsuite/gcc.dg/long-long-cst1.c | 2 +- gcc/testsuite/gcc.dg/mallign.c | 2 +- gcc/testsuite/gcc.dg/max-1.c | 17 +++++----- gcc/testsuite/gcc.dg/pointer-arith-10.c | 4 +-- gcc/testsuite/gcc.dg/pr14092-1.c | 2 +- gcc/testsuite/gcc.dg/pr25682.c | 4 +-- gcc/testsuite/gcc.dg/pr30744-1.c | 10 +++--- gcc/testsuite/gcc.dg/pr34856.c | 2 +- gcc/testsuite/gcc.dg/pr37561.c | 2 +- gcc/testsuite/gcc.dg/pr38700.c | 2 +- gcc/testsuite/gcc.dg/pr41551.c | 4 +-- gcc/testsuite/gcc.dg/sequence-pt-1.c | 6 ++-- gcc/testsuite/gcc.dg/torture/pr39074.c | 2 +- gcc/testsuite/gcc.dg/torture/pta-escape-1.c | 4 +-- gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c | 2 +- gcc/testsuite/gcc.dg/vla-11.c | 2 +- 29 files changed, 106 insertions(+), 62 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7773d30..7a764f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,44 @@ +2012-04-11 Bernd Schmidt + + * gcc.dg/c99-const-expr-9.c (old_offsetof): Insert a cast to + __UINTPTR_TYPE__. + * gcc.c-torture/execute/pr15296.c (intptr_t): Likewise, with + __INTPTR_TYPE__. + * gcc.dg/pr14092-1.c (intptr_t): Likewise. + * gcc.dg/tree-ssa/foldcast-1.c (ssize_t): Likewise. + * gcc.dg/c90-const-expr-6.c (intptr_t): New typedef to replace ... + (ptrdiff_t): ... this. All uses changed. + * gcc.dg/c99-const-expr-6.c (intptr_t, ptrdiff_t): Likewise. + * gcc.dg/torture/pta-escape-1.c (foo): Change arg type to + __INTPTR_TYPE__. + (main): Cast argument to __INTPTR_TYPE__. + * gcc.dg/20041106-1.c (main): Cast to __UINTPTR_TYPE__ rather than + size_t. + * gcc.dg/mallign.c (main): Likewise. + * gcc.dg/pr38700.c (foo): Likewise. + * gcc.dg/long-long-cst1.c (t): Likewise. + * gcc.dg/c99-const-expr-10.c (p, q, f, h, h2): Likewise. + * gcc.dg/array-10.c (c0, c1, c2, c3, c4, c5): Likewise. + * gcc.dg/pointer-arith-10.c (foo): Likewise. + * gcc.dg/pr25682.c (d, foo): Likewise. + * gcc.dg/format/cast-1.c (f): Likewise. + * gcc.dg/c90-const-expr-10.c + * gcc.dg/pr41551.c (uintptr_t): New typedef, replacing... + (size_t): ...this. All uses changed. + * gcc.c-torture/execute/pr22098-1.c (uintptr_t): Likewise. + * gcc.c-torture/execute/pr22098-2.c (uintptr_t): Likewise. + * gcc.c-torture/execute/pr22098-3.c (uintptr_t): Likewise. + * gcc.dg/pr34856.c (uintptr_t): Likewise. + * gcc.dg/sequence-pt-1.c: Likewise. + * gcc.dg/c90-const-expr-9.c (uintptr_t): Likewise. + * gcc.dg/max-1.c (intptr_t): Likewise, replacing ssize_t. + * gcc.dg/pr39074.c (intptr_t): Define using __INTPTR_TYPE__. + * gcc.dg/pr30744-1.c (my_intptr_t): New typedef. Replace all uses + of ptrdiff_t with it. + * gcc.dg/inline-23.c (my_intptr_t): Likewise. + * gcc.dg/pr37561.c (p): Use __INTPTR_TYPE__. + * gcc.dg/vla-11.c (foo11b): Use __UINTPTR_TYPE__. + 2012-04-11 Jason Merrill PR debug/45088 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr15296.c b/gcc/testsuite/gcc.c-torture/execute/pr15296.c index d2468e4..a3b53cb 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr15296.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr15296.c @@ -3,7 +3,7 @@ fall-through code, while that register held a pointer used in code at the branch target. */ -typedef int __attribute__ ((mode (__pointer__))) intptr_t; +typedef __INTPTR_TYPE__ intptr_t; typedef intptr_t W; union u0 { diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c b/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c index 142530f..7e876fa 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c @@ -1,13 +1,13 @@ extern void abort (void); extern void exit (int); -typedef __SIZE_TYPE__ size_t; +typedef __UINTPTR_TYPE__ uintptr_t; int main (void) { int a = 0; int *p; - size_t b; - b = (size_t)(p = &(int []){0, 1, 2}[++a]); + uintptr_t b; + b = (uintptr_t)(p = &(int []){0, 1, 2}[++a]); if (a != 1 || *p != 1 || *(int *)b != 1) abort (); exit (0); diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c b/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c index 249647d..035a755 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c @@ -1,13 +1,13 @@ extern void abort (void); extern void exit (int); -typedef __SIZE_TYPE__ size_t; +typedef __UINTPTR_TYPE__ uintptr_t; int main (void) { int a = 0; int *p; - size_t b; - b = (size_t)(p = &(int []){0, 1, 2}[1]); + uintptr_t b; + b = (uintptr_t)(p = &(int []){0, 1, 2}[1]); if (*p != 1 || *(int *)b != 1) abort (); exit (0); diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c b/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c index 4c8a1c6..4f37be8 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c @@ -1,6 +1,6 @@ extern void abort (void); extern void exit (int); -typedef __SIZE_TYPE__ size_t; +typedef __UINTPTR_TYPE__ uintptr_t; int n = 0; int f (void) { return ++n; } int @@ -8,8 +8,8 @@ main (void) { int a = 0; int *p; - size_t b; - b = (size_t)(p = &(int []){0, f(), 2}[1]); + uintptr_t b; + b = (uintptr_t)(p = &(int []){0, f(), 2}[1]); if (*p != 1 || *(int *)b != 1 || n != 1) abort (); exit (0); diff --git a/gcc/testsuite/gcc.dg/20041106-1.c b/gcc/testsuite/gcc.dg/20041106-1.c index f83e835..f33ba01 100644 --- a/gcc/testsuite/gcc.dg/20041106-1.c +++ b/gcc/testsuite/gcc.dg/20041106-1.c @@ -21,7 +21,7 @@ int main () struct S *s; ptr = malloc (3*ps); - page = (char *)(((size_t)ptr + (ps - 1)) & -ps); + page = (char *)(((__UINTPTR_TYPE__)ptr + (ps - 1)) & -ps); munmap (page + ps, ps); s = (struct S *)(page + ps - sizeof(struct S)); diff --git a/gcc/testsuite/gcc.dg/array-10.c b/gcc/testsuite/gcc.dg/array-10.c index 3b4d512..44457d1 100644 --- a/gcc/testsuite/gcc.dg/array-10.c +++ b/gcc/testsuite/gcc.dg/array-10.c @@ -13,12 +13,12 @@ struct b3 { int x[a]; }; /* { dg-error "17:at file scope" } */ struct b4 { int (*x)[a]; }; /* { dg-error "19:at file scope" } */ typeof (int [a]) b5; /* { dg-error "at file scope|outside of any function" } */ -int c0[(__SIZE_TYPE__)&a]; /* { dg-error "5:at file scope" } */ -int (*c1)[(__SIZE_TYPE__)&a]; /* { dg-error "7:at file scope" } */ -int (*c2())[(__SIZE_TYPE__)&a]; /* { dg-error "7:at file scope" } */ -struct c3 { int x[(__SIZE_TYPE__)&a]; }; /* { dg-error "17:at file scope" } */ -struct c4 { int (*x)[(__SIZE_TYPE__)&a]; }; /* { dg-error "19:at file scope" } */ -typeof (int [(__SIZE_TYPE__)&a]) c5; /* { dg-error "34:at file scope" } */ +int c0[(__UINTPTR_TYPE__)&a]; /* { dg-error "5:at file scope" } */ +int (*c1)[(__UINTPTR_TYPE__)&a]; /* { dg-error "7:at file scope" } */ +int (*c2())[(__UINTPTR_TYPE__)&a]; /* { dg-error "7:at file scope" } */ +struct c3 { int x[(__UINTPTR_TYPE__)&a]; }; /* { dg-error "17:at file scope" } */ +struct c4 { int (*x)[(__UINTPTR_TYPE__)&a]; }; /* { dg-error "19:at file scope" } */ +typeof (int [(__UINTPTR_TYPE__)&a]) c5; /* { dg-error "37:at file scope" } */ int d0[1/0]; /* { dg-error "5:at file scope" } */ /* { dg-warning "9:division by zero" "" { target *-*-* } 23 } */ diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-6.c b/gcc/testsuite/gcc.dg/c90-const-expr-6.c index c432cca..50239ce 100644 --- a/gcc/testsuite/gcc.dg/c90-const-expr-6.c +++ b/gcc/testsuite/gcc.dg/c90-const-expr-6.c @@ -4,13 +4,13 @@ /* { dg-do compile } */ /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ -__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t; +__extension__ typedef __INTPTR_TYPE__ intptr_t; /* PR 29116. */ int n = 0, p[n * 0 + 1]; /* { dg-error "variabl|can't be evaluated" } */ /* PR 31871. */ -extern int c[1 + ((ptrdiff_t) (void *) 0)]; /* { dg-error "variab|can't be evaluated" } */ +extern int c[1 + ((intptr_t) (void *) 0)]; /* { dg-error "variab|can't be evaluated" } */ /* Implicit conversions from floating-point constants are not OK, although explicit ones are. */ @@ -34,7 +34,7 @@ struct s { }; enum e { - E = (1 + ((ptrdiff_t) (void *) 0)), /* { dg-error "constant" } */ + E = (1 + ((intptr_t) (void *) 0)), /* { dg-error "constant" } */ E2 = 0 }; @@ -46,7 +46,7 @@ enum f { void f (int a) { - int v[1 + ((ptrdiff_t) (void *) 0)]; /* { dg-error "variab|can't be evaluated" } */ + int v[1 + ((intptr_t) (void *) 0)]; /* { dg-error "variab|can't be evaluated" } */ switch (a) { case (n * 0 + 1): /* { dg-error "constant" } */ diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-9.c b/gcc/testsuite/gcc.dg/c90-const-expr-9.c index a06cdd9..0d5d8c1 100644 --- a/gcc/testsuite/gcc.dg/c90-const-expr-9.c +++ b/gcc/testsuite/gcc.dg/c90-const-expr-9.c @@ -15,8 +15,9 @@ struct t { }; __extension__ typedef __SIZE_TYPE__ size_t; +__extension__ typedef __UINTPTR_TYPE__ uintptr_t; -#define old_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#define old_offsetof(TYPE, MEMBER) ((size_t) (uintptr_t) &((TYPE *)0)->MEMBER) enum e { E1 = old_offsetof (struct s, a), /* { dg-error "constant" } */ diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-6.c b/gcc/testsuite/gcc.dg/c99-const-expr-6.c index 1a31ddc..ca60243 100644 --- a/gcc/testsuite/gcc.dg/c99-const-expr-6.c +++ b/gcc/testsuite/gcc.dg/c99-const-expr-6.c @@ -8,7 +8,7 @@ int n = 0, p[n * 0 + 1]; /* { dg-error "variabl" } */ /* PR 31871. */ -extern int c[1 + ((__PTRDIFF_TYPE__) (void *) 0)]; /* { dg-error "variab" } */ +extern int c[1 + ((__INTPTR_TYPE__) (void *) 0)]; /* { dg-error "variab" } */ /* Implicit conversions from floating-point constants are not OK, although explicit ones are. */ @@ -32,7 +32,7 @@ struct s { }; enum e { - E = (1 + ((__PTRDIFF_TYPE__) (void *) 0)), /* { dg-error "constant" } */ + E = (1 + ((__INTPTR_TYPE__) (void *) 0)), /* { dg-error "constant" } */ E2 = 0 }; diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-9.c b/gcc/testsuite/gcc.dg/c99-const-expr-9.c index 48f43ed..a0a6a96 100644 --- a/gcc/testsuite/gcc.dg/c99-const-expr-9.c +++ b/gcc/testsuite/gcc.dg/c99-const-expr-9.c @@ -14,7 +14,7 @@ struct t { int b[2]; }; -#define old_offsetof(TYPE, MEMBER) ((__SIZE_TYPE__) &((TYPE *)0)->MEMBER) +#define old_offsetof(TYPE, MEMBER) ((__SIZE_TYPE__)(__UINTPTR_TYPE__) &((TYPE *)0)->MEMBER) enum e { E1 = old_offsetof (struct s, a), /* { dg-error "constant" } */ diff --git a/gcc/testsuite/gcc.dg/format/cast-1.c b/gcc/testsuite/gcc.dg/format/cast-1.c index 03e624a..5d1d477 100644 --- a/gcc/testsuite/gcc.dg/format/cast-1.c +++ b/gcc/testsuite/gcc.dg/format/cast-1.c @@ -11,6 +11,6 @@ void f (int x) { printf("%s", x); /* { dg-warning "format" } */ - printf((char *)(size_t)"%s", x); /* { dg-warning "format" } */ + printf((char *)(__UINTPTR_TYPE__)"%s", x); /* { dg-warning "format" } */ printf((char *)(char)"%s", x); /* { dg-warning "cast from pointer to integer of different size" } */ } diff --git a/gcc/testsuite/gcc.dg/inline-23.c b/gcc/testsuite/gcc.dg/inline-23.c index 55bd72a..2829ecb 100644 --- a/gcc/testsuite/gcc.dg/inline-23.c +++ b/gcc/testsuite/gcc.dg/inline-23.c @@ -3,16 +3,19 @@ /* Make sure we can inline a varargs function whose variable arguments are not used. See PR32493. */ #include + +typedef __INTPTR_TYPE__ my_intptr_t; + static inline __attribute__((always_inline)) void __check_printsym_format(const char *fmt, ...) { } static inline __attribute__((always_inline)) void print_symbol(const char *fmt, -ptrdiff_t addr) +my_intptr_t addr) { __check_printsym_format(fmt, ""); } void do_initcalls(void **call) { - print_symbol(": %s()", (ptrdiff_t) *call); + print_symbol(": %s()", (my_intptr_t) *call); } diff --git a/gcc/testsuite/gcc.dg/long-long-cst1.c b/gcc/testsuite/gcc.dg/long-long-cst1.c index 7c60648..800d6d6 100644 --- a/gcc/testsuite/gcc.dg/long-long-cst1.c +++ b/gcc/testsuite/gcc.dg/long-long-cst1.c @@ -7,7 +7,7 @@ extern void abort(); struct st{ int _mark; }; -unsigned long long t = ((int)(__SIZE_TYPE__)&(((struct st*)16)->_mark) - 32); +unsigned long long t = ((int)(__UINTPTR_TYPE__)&(((struct st*)16)->_mark) - 32); int main() { diff --git a/gcc/testsuite/gcc.dg/mallign.c b/gcc/testsuite/gcc.dg/mallign.c index 6a0041e..349cdaa 100644 --- a/gcc/testsuite/gcc.dg/mallign.c +++ b/gcc/testsuite/gcc.dg/mallign.c @@ -9,7 +9,7 @@ typedef int word __attribute__((mode(word))); int main() { - if ((size_t)malloc (1) & (sizeof(word)-1)) + if ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1)) abort (); return 0; } diff --git a/gcc/testsuite/gcc.dg/max-1.c b/gcc/testsuite/gcc.dg/max-1.c index 40f2145..9823dca 100644 --- a/gcc/testsuite/gcc.dg/max-1.c +++ b/gcc/testsuite/gcc.dg/max-1.c @@ -7,19 +7,16 @@ /* m32c has varying sized pointers */ /* { dg-skip-if "" { "m32c-*-*" } { "*" } { "-mcpu=m32c" "-mcpu=m32cm" } } */ -/* Kludge to make it signed. */ -#define unsigned signed -__extension__ typedef __SIZE_TYPE__ ssize_t; -#undef unsigned +__extension__ typedef __INTPTR_TYPE__ intptr_t; extern void abort (void); -ssize_t fff[10]; +intptr_t fff[10]; -void f(ssize_t a, ssize_t b) +void f(intptr_t a, intptr_t b) { - ssize_t crcc = b; - ssize_t d = *((ssize_t*)(a+1)); + intptr_t crcc = b; + intptr_t d = *((intptr_t*)(a+1)); int i; a = d >= b? d:b; @@ -32,11 +29,11 @@ void f(ssize_t a, ssize_t b) /* The variable a cannot be a local variable as we get better aliasing now and decide that the store to a is dead. The better aliasing comes from better representation of pointer arithmetic. */ -ssize_t a = 10; +intptr_t a = 10; int main(void) { int i; - f((ssize_t)(&a)-1,0); + f((intptr_t)(&a)-1,0); for(i = 0;i<10;i++) if (fff[i]!=10) abort (); diff --git a/gcc/testsuite/gcc.dg/pointer-arith-10.c b/gcc/testsuite/gcc.dg/pointer-arith-10.c index 220891e..52b1989 100644 --- a/gcc/testsuite/gcc.dg/pointer-arith-10.c +++ b/gcc/testsuite/gcc.dg/pointer-arith-10.c @@ -1,9 +1,9 @@ /* { dg-do compile } */ /* { dg-options "-fdump-tree-original" } */ -char *foo(char *p, __SIZE_TYPE__ i) +char *foo(char *p, __UINTPTR_TYPE__ i) { - return (char *)i + (__SIZE_TYPE__)p; + return (char *)i + (__UINTPTR_TYPE__)p; } /* { dg-final { scan-tree-dump "p +" "original" } } */ diff --git a/gcc/testsuite/gcc.dg/pr14092-1.c b/gcc/testsuite/gcc.dg/pr14092-1.c index 927ecf6..1c103cc 100644 --- a/gcc/testsuite/gcc.dg/pr14092-1.c +++ b/gcc/testsuite/gcc.dg/pr14092-1.c @@ -6,7 +6,7 @@ /* Define this so that we are more portable. The testcase in the PR failed on 64-bit hosts. */ -typedef int __attribute__ ((mode (__pointer__))) intptr_t; +typedef __INTPTR_TYPE__ intptr_t; typedef struct _PLCI { unsigned char x; diff --git a/gcc/testsuite/gcc.dg/pr25682.c b/gcc/testsuite/gcc.dg/pr25682.c index 8c51d82..e8cab1d 100644 --- a/gcc/testsuite/gcc.dg/pr25682.c +++ b/gcc/testsuite/gcc.dg/pr25682.c @@ -11,7 +11,7 @@ struct S }; char c[(char *) &((struct S *) 0)->b - (char *) 0]; /* { dg-warning "variably modified" } */ -char d[(__SIZE_TYPE__) &((struct S *) 8)->b]; /* { dg-warning "variably modified" } */ +char d[(__UINTPTR_TYPE__) &((struct S *) 8)->b]; /* { dg-warning "variably modified" } */ char e[sizeof (c) == __builtin_offsetof (struct S, b) ? 1 : -1]; char f[sizeof (d) == __builtin_offsetof (struct S, b) + 8 ? 1 : -1]; @@ -21,7 +21,7 @@ void foo (void) { char g[(char *) &((struct S *) 0)->b - (char *) 0]; - char h[(__SIZE_TYPE__) &((struct S *) 8)->b]; + char h[(__UINTPTR_TYPE__) &((struct S *) 8)->b]; char i[sizeof (g) == __builtin_offsetof (struct S, b) ? 1 : -1]; char j[sizeof (h) == __builtin_offsetof (struct S, b) + 8 ? 1 : -1]; bar (g, h); diff --git a/gcc/testsuite/gcc.dg/pr30744-1.c b/gcc/testsuite/gcc.dg/pr30744-1.c index a35c552..f08f3be 100644 --- a/gcc/testsuite/gcc.dg/pr30744-1.c +++ b/gcc/testsuite/gcc.dg/pr30744-1.c @@ -2,15 +2,17 @@ /* { dg-options "-O2" } */ #include +typedef __INTPTR_TYPE__ my_intptr_t; + typedef struct { - ptrdiff_t unique; + my_intptr_t unique; } G; void r(G* n) { - ptrdiff_t p; - if (((G *) ((void *)((~(ptrdiff_t)(p))))) != ((void *)0)) { - ((G *) ((void *)((~(ptrdiff_t)(p)))))->unique = n->unique; + my_intptr_t p; + if (((G *) ((void *)((~(my_intptr_t)(p))))) != ((void *)0)) { + ((G *) ((void *)((~(my_intptr_t)(p)))))->unique = n->unique; } } diff --git a/gcc/testsuite/gcc.dg/pr34856.c b/gcc/testsuite/gcc.dg/pr34856.c index 6bfc704..62041e2 100644 --- a/gcc/testsuite/gcc.dg/pr34856.c +++ b/gcc/testsuite/gcc.dg/pr34856.c @@ -3,7 +3,7 @@ /* { dg-options "-O2 -msse2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-options "-O2 -maltivec" { target { powerpc*-*-linux* && powerpc_altivec_ok } } } */ -typedef unsigned __attribute__ ((__mode__ (__pointer__))) uintptr_t; +typedef __UINTPTR_TYPE__ uintptr_t; #undef __vector #define __vector __attribute__ ((__vector_size__ (16))) diff --git a/gcc/testsuite/gcc.dg/pr37561.c b/gcc/testsuite/gcc.dg/pr37561.c index ec712a7..3ad8263 100644 --- a/gcc/testsuite/gcc.dg/pr37561.c +++ b/gcc/testsuite/gcc.dg/pr37561.c @@ -1,7 +1,7 @@ /* PR c++/37561 */ /* { dg-do compile } */ -__extension__ __PTRDIFF_TYPE__ p; +__extension__ __INTPTR_TYPE__ p; char q; void diff --git a/gcc/testsuite/gcc.dg/pr38700.c b/gcc/testsuite/gcc.dg/pr38700.c index bfa75b0..ebece7f 100644 --- a/gcc/testsuite/gcc.dg/pr38700.c +++ b/gcc/testsuite/gcc.dg/pr38700.c @@ -5,7 +5,7 @@ int foo () { - __SIZE_TYPE__ s = __builtin_expect ((__SIZE_TYPE__)&&L, 0); + __UINTPTR_TYPE__ s = __builtin_expect ((__UINTPTR_TYPE__)&&L, 0); L: return 0; } diff --git a/gcc/testsuite/gcc.dg/pr41551.c b/gcc/testsuite/gcc.dg/pr41551.c index e24fbc3..2f2ad2b 100644 --- a/gcc/testsuite/gcc.dg/pr41551.c +++ b/gcc/testsuite/gcc.dg/pr41551.c @@ -3,10 +3,10 @@ /* Make sure we do not ICE. */ -__extension__ typedef __SIZE_TYPE__ size_t; +__extension__ typedef __UINTPTR_TYPE__ uintptr_t; int main(void) { int var, *p = &var; - return (double)(size_t)(p); + return (double)(uintptr_t)(p); } diff --git a/gcc/testsuite/gcc.dg/sequence-pt-1.c b/gcc/testsuite/gcc.dg/sequence-pt-1.c index 05eee82..2e22b66 100644 --- a/gcc/testsuite/gcc.dg/sequence-pt-1.c +++ b/gcc/testsuite/gcc.dg/sequence-pt-1.c @@ -15,7 +15,7 @@ extern int fnb (int, int); extern int fnc (int *); extern int sprintf (char *, const char *, ...); -typedef __SIZE_TYPE__ size_t; +typedef __UINTPTR_TYPE__ uintptr_t; void foo (int a, int b, int n, int p, int *ptr, struct s *sptr, @@ -32,9 +32,9 @@ foo (int a, int b, int n, int p, int *ptr, struct s *sptr, ap[++n] = bp[--n]; /* { dg-warning "undefined" "sequence point warning" } */ cp[n][n] = cp[n][n]++; /* { dg-warning "undefined" "sequence point warning" } */ cp[n][p] = cp[n][n++]; /* { dg-warning "undefined" "sequence point warning" } */ - *ptr++ = (size_t)ptr++; /* { dg-warning "undefined" "sequence point warning" } */ + *ptr++ = (uintptr_t)ptr++; /* { dg-warning "undefined" "sequence point warning" } */ sptr->a = sptr->a++; /* { dg-warning "undefined" "sequence point warning" } */ - sptr->a = (size_t)(sptr++); /* { dg-warning "undefined" "sequence point warning" } */ + sptr->a = (uintptr_t)(sptr++); /* { dg-warning "undefined" "sequence point warning" } */ *ptr++ = fn (*ptr); /* { dg-warning "undefined" "sequence point warning" } */ a = b = a++; /* { dg-warning "undefined" "sequence point warning" } */ b = a = --b; /* { dg-warning "undefined" "sequence point warning" } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr39074.c b/gcc/testsuite/gcc.dg/torture/pr39074.c index 4775062..89c4ac6 100644 --- a/gcc/testsuite/gcc.dg/torture/pr39074.c +++ b/gcc/testsuite/gcc.dg/torture/pr39074.c @@ -2,7 +2,7 @@ /* { dg-options "-fdump-tree-alias" } */ /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */ -typedef __PTRDIFF_TYPE__ intptr_t; +typedef __INTPTR_TYPE__ intptr_t; int i; void __attribute__((noinline)) diff --git a/gcc/testsuite/gcc.dg/torture/pta-escape-1.c b/gcc/testsuite/gcc.dg/torture/pta-escape-1.c index dbfd4c9..d3cb254 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-escape-1.c +++ b/gcc/testsuite/gcc.dg/torture/pta-escape-1.c @@ -9,7 +9,7 @@ bar (void) *p = 1; } int __attribute__((noinline,noclone)) -foo (__SIZE_TYPE__ addr) +foo (__INTPTR_TYPE__ addr) { int i; /* q points to ANYTHING */ @@ -25,7 +25,7 @@ extern void abort (void); int main() { - if (foo ((__SIZE_TYPE__)&p) != 1) + if (foo ((__INTPTR_TYPE__)&p) != 1) abort (); return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c b/gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c index 08b827c..9444f0b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-fdump-tree-original" } */ -typedef int ssize_t __attribute__((mode(pointer))); +typedef __INTPTR_TYPE__ ssize_t; ssize_t foo (ssize_t x) { return (ssize_t)(char *)x; diff --git a/gcc/testsuite/gcc.dg/vla-11.c b/gcc/testsuite/gcc.dg/vla-11.c index 8948e6b..9c23e86 100644 --- a/gcc/testsuite/gcc.dg/vla-11.c +++ b/gcc/testsuite/gcc.dg/vla-11.c @@ -7,7 +7,7 @@ /* { dg-options "-std=c99 -pedantic-errors" } */ void foo11a(int x[sizeof(int *(*)[*])]); /* { dg-warning "not in a declaration" } */ -void foo11b(__SIZE_TYPE__ x, int y[(__SIZE_TYPE__)(int (*)[*])x]); /* { dg-warning "not in a declaration" } */ +void foo11b(__SIZE_TYPE__ x, int y[(__UINTPTR_TYPE__)(int (*)[*])x]); /* { dg-warning "not in a declaration" } */ void foo11c(struct s { int (*x)[*]; } *y); /* { dg-error "a member of a structure or union cannot have a variably modified type" "variably modified" } */ /* { dg-warning "'struct s' declared inside parameter list" "struct decl" { target *-*-* } 11 } */ /* { dg-warning "its scope is only this definition or declaration" "struct scope" { target *-*-* } 11 } */ -- 2.7.4