Patchwork intptr fixes for the testsuite

login
register
mail settings
Submitter Bernd Schmidt
Date April 11, 2012, 1:55 p.m.
Message ID <4F858D5A.80101@codesourcery.com>
Download mbox | patch
Permalink /patch/151797/
State New
Headers show

Comments

Bernd Schmidt - April 11, 2012, 1:55 p.m.
I'm working on a target where intptr_t and pointers are larger than
size_t and ptrdiff_t. The testsuite has problems in this area, since we
often use the latter two types for casting from/to pointers, leading to
unwanted warnings. In some cases I've checked the corresponding PRs and
found that the original testcases used something like plain int or long.

The following is a first pass to eliminate some of these problems.
Tested on i686-linux. Ok?


Bernd
* 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/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.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/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__.
Tristan Gingold - April 11, 2012, 2:02 p.m.
On Apr 11, 2012, at 3:55 PM, Bernd Schmidt wrote:

> I'm working on a target where intptr_t and pointers are larger than
> size_t and ptrdiff_t. The testsuite has problems in this area, since we
> often use the latter two types for casting from/to pointers, leading to
> unwanted warnings. In some cases I've checked the corresponding PRs and
> found that the original testcases used something like plain int or long.

Would this target be able to host gcc ?

Tristan.
Bernd Schmidt - April 11, 2012, 2:04 p.m.
On 04/11/2012 04:02 PM, Tristan Gingold wrote:
> 
> On Apr 11, 2012, at 3:55 PM, Bernd Schmidt wrote:
> 
>> I'm working on a target where intptr_t and pointers are larger than
>> size_t and ptrdiff_t. The testsuite has problems in this area, since we
>> often use the latter two types for casting from/to pointers, leading to
>> unwanted warnings. In some cases I've checked the corresponding PRs and
>> found that the original testcases used something like plain int or long.
> 
> Would this target be able to host gcc ?

I do not wish to think about this :) It's embedded, so hopefully no one
will try.

In principle, I'd think any target with enough memory can be made to
host gcc, with varying amounts of work.


Bernd
Mike Stump - April 11, 2012, 2:52 p.m.
On Apr 11, 2012, at 7:04 AM, Bernd Schmidt wrote:
> On 04/11/2012 04:02 PM, Tristan Gingold wrote:
>> 
>> On Apr 11, 2012, at 3:55 PM, Bernd Schmidt wrote:
>>> I'm working on a target where intptr_t and pointers are larger than
>>> size_t and ptrdiff_t. The testsuite has problems in this area, since we
>>> often use the latter two types for casting from/to pointers, leading to
>>> unwanted warnings. In some cases I've checked the corresponding PRs and
>>> found that the original testcases used something like plain int or long.
>> 
>> Would this target be able to host gcc ?
> 
> I do not wish to think about this :) It's embedded, so hopefully no one
> will try.
> 
> In principle, I'd think any target with enough memory can be made to
> host gcc, with varying amounts of work.

I've hosted gcc on mine, mainly as a code generation correctness check...  It's nice having a simulator and enough address bits, you can just plop down yet more memory and presto, everything just works.  The more annoying aspect is having to wire up stat and readdir for sim.  Fork and exec, are more trivial by comparison.  Some gcc ports might not have enough address bits, that might be the only hard requirement that one cannot fudge.
Mike Stump - April 11, 2012, 2:56 p.m.
On Apr 11, 2012, at 6:55 AM, Bernd Schmidt wrote:
> I'm working on a target where intptr_t and pointers are larger than
> size_t and ptrdiff_t.

Hum, we question your sanity....  :-)

> Ok?

Ok.  I hope you tested it on your target too!
Tristan Gingold - April 11, 2012, 3 p.m.
On Apr 11, 2012, at 4:52 PM, Mike Stump wrote:

> On Apr 11, 2012, at 7:04 AM, Bernd Schmidt wrote:
>> On 04/11/2012 04:02 PM, Tristan Gingold wrote:
>>> 
>>> On Apr 11, 2012, at 3:55 PM, Bernd Schmidt wrote:
>>>> I'm working on a target where intptr_t and pointers are larger than
>>>> size_t and ptrdiff_t. The testsuite has problems in this area, since we
>>>> often use the latter two types for casting from/to pointers, leading to
>>>> unwanted warnings. In some cases I've checked the corresponding PRs and
>>>> found that the original testcases used something like plain int or long.
>>> 
>>> Would this target be able to host gcc ?
>> 
>> I do not wish to think about this :) It's embedded, so hopefully no one
>> will try.
>> 
>> In principle, I'd think any target with enough memory can be made to
>> host gcc, with varying amounts of work.
> 
> I've hosted gcc on mine, mainly as a code generation correctness check...  It's nice having a simulator and enough address bits, you can just plop down yet more memory and presto, everything just works.  The more annoying aspect is having to wire up stat and readdir for sim.  Fork and exec, are more trivial by comparison.  Some gcc ports might not have enough address bits, that might be the only hard requirement that one cannot fudge.

VMS is an host/target where pointers (64 bits) can be larger than size_t and ptrdiff_t.
We can run gcc on it, but we also still have a very few patches to submit to achieve that!

Tristan.

Patch

Index: gcc/testsuite/gcc.c-torture/execute/pr22098-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr22098-1.c	(revision 186270)
+++ gcc/testsuite/gcc.c-torture/execute/pr22098-1.c	(working copy)
@@ -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);
Index: gcc/testsuite/gcc.c-torture/execute/pr22098-3.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr22098-3.c	(revision 186270)
+++ gcc/testsuite/gcc.c-torture/execute/pr22098-3.c	(working copy)
@@ -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);
Index: gcc/testsuite/gcc.c-torture/execute/pr15296.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr15296.c	(revision 186270)
+++ gcc/testsuite/gcc.c-torture/execute/pr15296.c	(working copy)
@@ -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
 {
Index: gcc/testsuite/gcc.c-torture/execute/pr22098-2.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr22098-2.c	(revision 186270)
+++ gcc/testsuite/gcc.c-torture/execute/pr22098-2.c	(working copy)
@@ -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);
Index: gcc/testsuite/gcc.dg/pr34856.c
===================================================================
--- gcc/testsuite/gcc.dg/pr34856.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr34856.c	(working copy)
@@ -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)))
Index: gcc/testsuite/gcc.dg/c99-const-expr-9.c
===================================================================
--- gcc/testsuite/gcc.dg/c99-const-expr-9.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/c99-const-expr-9.c	(working copy)
@@ -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" } */
Index: gcc/testsuite/gcc.dg/20041106-1.c
===================================================================
--- gcc/testsuite/gcc.dg/20041106-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/20041106-1.c	(working copy)
@@ -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));
Index: gcc/testsuite/gcc.dg/pr38700.c
===================================================================
--- gcc/testsuite/gcc.dg/pr38700.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr38700.c	(working copy)
@@ -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;
 }
Index: gcc/testsuite/gcc.dg/c99-const-expr-6.c
===================================================================
--- gcc/testsuite/gcc.dg/c99-const-expr-6.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/c99-const-expr-6.c	(working copy)
@@ -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
 };
 
Index: gcc/testsuite/gcc.dg/max-1.c
===================================================================
--- gcc/testsuite/gcc.dg/max-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/max-1.c	(working copy)
@@ -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 ();
Index: gcc/testsuite/gcc.dg/pr41551.c
===================================================================
--- gcc/testsuite/gcc.dg/pr41551.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr41551.c	(working copy)
@@ -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);
 }
Index: gcc/testsuite/gcc.dg/long-long-cst1.c
===================================================================
--- gcc/testsuite/gcc.dg/long-long-cst1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/long-long-cst1.c	(working copy)
@@ -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()
 {
Index: gcc/testsuite/gcc.dg/array-10.c
===================================================================
--- gcc/testsuite/gcc.dg/array-10.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/array-10.c	(working copy)
@@ -13,12 +13,12 @@  struct b3 { int x[a]; }; /* { dg-error "
 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 } */
Index: gcc/testsuite/gcc.dg/pointer-arith-10.c
===================================================================
--- gcc/testsuite/gcc.dg/pointer-arith-10.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pointer-arith-10.c	(working copy)
@@ -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" } } */
Index: gcc/testsuite/gcc.dg/pr30744-1.c
===================================================================
--- gcc/testsuite/gcc.dg/pr30744-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr30744-1.c	(working copy)
@@ -2,15 +2,17 @@ 
 /* { dg-options "-O2" } */
 #include <stddef.h>
 
+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;
   }
 }
 
Index: gcc/testsuite/gcc.dg/pr37561.c
===================================================================
--- gcc/testsuite/gcc.dg/pr37561.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr37561.c	(working copy)
@@ -1,7 +1,7 @@ 
 /* PR c++/37561 */
 /* { dg-do compile } */
 
-__extension__ __PTRDIFF_TYPE__ p;
+__extension__ __INTPTR_TYPE__ p;
 char q;
 
 void
Index: gcc/testsuite/gcc.dg/pr14092-1.c
===================================================================
--- gcc/testsuite/gcc.dg/pr14092-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr14092-1.c	(working copy)
@@ -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;
Index: gcc/testsuite/gcc.dg/vla-11.c
===================================================================
--- gcc/testsuite/gcc.dg/vla-11.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/vla-11.c	(working copy)
@@ -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 } */
Index: gcc/testsuite/gcc.dg/sequence-pt-1.c
===================================================================
--- gcc/testsuite/gcc.dg/sequence-pt-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/sequence-pt-1.c	(working copy)
@@ -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 *pt
   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" } */
Index: gcc/testsuite/gcc.dg/c90-const-expr-9.c
===================================================================
--- gcc/testsuite/gcc.dg/c90-const-expr-9.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/c90-const-expr-9.c	(working copy)
@@ -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" } */
Index: gcc/testsuite/gcc.dg/torture/pr39074.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr39074.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/torture/pr39074.c	(working copy)
@@ -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))
Index: gcc/testsuite/gcc.dg/torture/pta-escape-1.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pta-escape-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/torture/pta-escape-1.c	(working copy)
@@ -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;
 }
Index: gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/tree-ssa/foldcast-1.c	(working copy)
@@ -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;
Index: gcc/testsuite/gcc.dg/inline-23.c
===================================================================
--- gcc/testsuite/gcc.dg/inline-23.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/inline-23.c	(working copy)
@@ -3,16 +3,19 @@ 
 /* Make sure we can inline a varargs function whose variable arguments
    are not used.  See PR32493.  */
 #include <stddef.h>
+
+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);
 }
Index: gcc/testsuite/gcc.dg/mallign.c
===================================================================
--- gcc/testsuite/gcc.dg/mallign.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/mallign.c	(working copy)
@@ -9,7 +9,7 @@  typedef int word __attribute__((mode(wor
 
 int main()
 {
-    if ((size_t)malloc (1) & (sizeof(word)-1))
+    if ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1))
 	abort ();
     return 0;
 }                                                                              
Index: gcc/testsuite/gcc.dg/c90-const-expr-6.c
===================================================================
--- gcc/testsuite/gcc.dg/c90-const-expr-6.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/c90-const-expr-6.c	(working copy)
@@ -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" } */
Index: gcc/testsuite/gcc.dg/pr25682.c
===================================================================
--- gcc/testsuite/gcc.dg/pr25682.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/pr25682.c	(working copy)
@@ -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);
Index: gcc/testsuite/gcc.dg/format/cast-1.c
===================================================================
--- gcc/testsuite/gcc.dg/format/cast-1.c	(revision 186270)
+++ gcc/testsuite/gcc.dg/format/cast-1.c	(working copy)
@@ -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" } */
 }