diff mbox

Migrating gcc.c-torture

Message ID 53D0497D.2070704@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt July 23, 2014, 11:47 p.m. UTC
This is an idea I discussed with a few folks at the Cauldron, and since 
they made supportive noises, I decided to work on it. The problem I'm 
trying to solve is that for ptx, I'll have to mark a lot of testcases as 
unsupported (uses of things such as indirect jumps, alloca, and 
sometimes K&R-style function definitions). In c-torture/execute, we 
can't use dg-require-effective-target directives, and using .x files 
feels a little antiquated. So I've started to work on a little shell 
script which migrates files out of c-torture/{compile,execute} and into 
gcc.dg/torture, or c-c++-common/torture if the test seems to work for 
C++ as well.

Below is the current script, which produced no new failures on my latest 
run of testing on x86_64-linux. Some tests remain in c-torture (mostly 
because of warnings), but their number can be somewhat reduced by 
applying a preliminary patch first. This fixes up warnings in some 
testcases when doing so does not appear to affect what they are testing 
for. We can decide later what to do with the remaining tests (such as 
adding dg-warning as appropriate).

One thing to note is that this script will migrate most of the limits 
tests to c-c++-common, increasing runtime of the testsuite a bit.

Comments, objections? Ok to apply the preliminary patch?

Any other targets I should add to the list of compilers that are run 
before deciding where to move the test? Does anyone want to see the full 
patch in the final submission (git doesn't seem to produce something 
nice for the renames unfortunately) or just the script and generated 
ChangeLog?


Bernd

Comments

Andrew Pinski July 23, 2014, 11:52 p.m. UTC | #1
On Wed, Jul 23, 2014 at 4:47 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> This is an idea I discussed with a few folks at the Cauldron, and since they
> made supportive noises, I decided to work on it. The problem I'm trying to
> solve is that for ptx, I'll have to mark a lot of testcases as unsupported
> (uses of things such as indirect jumps, alloca, and sometimes K&R-style
> function definitions). In c-torture/execute, we can't use
> dg-require-effective-target directives, and using .x files feels a little
> antiquated. So I've started to work on a little shell script which migrates
> files out of c-torture/{compile,execute} and into gcc.dg/torture, or
> c-c++-common/torture if the test seems to work for C++ as well.
>
> Below is the current script, which produced no new failures on my latest run
> of testing on x86_64-linux. Some tests remain in c-torture (mostly because
> of warnings), but their number can be somewhat reduced by applying a
> preliminary patch first. This fixes up warnings in some testcases when doing
> so does not appear to affect what they are testing for. We can decide later
> what to do with the remaining tests (such as adding dg-warning as
> appropriate).
>
> One thing to note is that this script will migrate most of the limits tests
> to c-c++-common, increasing runtime of the testsuite a bit.
>
> Comments, objections? Ok to apply the preliminary patch?

Yes, what if you don't move the tests but just change how the .exp to
use the same infrastructure as gcc.dg/torture instead?
I think changing the testcase in some cases is changing what is being
tested so a script doing it automatically is not a good thing.  Each
testcase should be audited instead.

Thanks,
Andrew Pinski

>
> Any other targets I should add to the list of compilers that are run before
> deciding where to move the test? Does anyone want to see the full patch in
> the final submission (git doesn't seem to produce something nice for the
> renames unfortunately) or just the script and generated ChangeLog?
>
>
> Bernd
Thomas Schwinge July 24, 2014, 6:35 a.m. UTC | #2
Hi!

On Thu, 24 Jul 2014 01:47:09 +0200, Bernd Schmidt <bernds@codesourcery.com> wrote:
> (git doesn't seem to produce something 
> nice for the renames unfortunately)

Are you maybe looking for the the -M or -C options to certain commands
(diff, show, ...)?


Grüße,
 Thomas
Jakub Jelinek July 24, 2014, 7:06 a.m. UTC | #3
On Wed, Jul 23, 2014 at 04:52:23PM -0700, Andrew Pinski wrote:
> > Comments, objections? Ok to apply the preliminary patch?
> 
> Yes, what if you don't move the tests but just change how the .exp to
> use the same infrastructure as gcc.dg/torture instead?

Yeah.  I believe gcc.c-torture/compile/ has been converted already,
so it is just about gcc.c-torture/execute/.  Each of these tests has
it's own default idioms, e.g. -w in by default in gcc.c-torture/.
So, please just tweak execute.exp, so that it does what it did until now
(perhaps with the exception of *.x files support) in dg framework, and
convert *.exp files into dg-* directives in the testcases.

	Jakub
Andreas Schwab July 24, 2014, 7:37 a.m. UTC | #4
Thomas Schwinge <thomas@codesourcery.com> writes:

> Hi!
>
> On Thu, 24 Jul 2014 01:47:09 +0200, Bernd Schmidt <bernds@codesourcery.com> wrote:
>> (git doesn't seem to produce something 
>> nice for the renames unfortunately)
>
> Are you maybe looking for the the -M or -C options to certain commands
> (diff, show, ...)?

Or set diff.renames in your .gitconfig.

Andreas.
Mike Stump July 24, 2014, 5:14 p.m. UTC | #5
On Jul 24, 2014, at 12:06 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Jul 23, 2014 at 04:52:23PM -0700, Andrew Pinski wrote:
>>> Comments, objections? Ok to apply the preliminary patch?
>> 
>> Yes, what if you don't move the tests but just change how the .exp to
>> use the same infrastructure as gcc.dg/torture instead?
> 
> Yeah.

I too support upgrade in place.
Mike Stump July 24, 2014, 5:17 p.m. UTC | #6
[ dup, sorry ]

On Jul 24, 2014, at 12:06 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Jul 23, 2014 at 04:52:23PM -0700, Andrew Pinski wrote:
>>> Comments, objections? Ok to apply the preliminary patch?
>> 
>> Yes, what if you don't move the tests but just change how the .exp to
>> use the same infrastructure as gcc.dg/torture instead?
> 
> Yeah.

I too support upgrade in place.
Joseph Myers July 28, 2014, 10:36 p.m. UTC | #7
On Thu, 24 Jul 2014, Jakub Jelinek wrote:

> On Wed, Jul 23, 2014 at 04:52:23PM -0700, Andrew Pinski wrote:
> > > Comments, objections? Ok to apply the preliminary patch?
> > 
> > Yes, what if you don't move the tests but just change how the .exp to
> > use the same infrastructure as gcc.dg/torture instead?
> 
> Yeah.  I believe gcc.c-torture/compile/ has been converted already,
> so it is just about gcc.c-torture/execute/.  Each of these tests has
> it's own default idioms, e.g. -w in by default in gcc.c-torture/.
> So, please just tweak execute.exp, so that it does what it did until now
> (perhaps with the exception of *.x files support) in dg framework, and
> convert *.exp files into dg-* directives in the testcases.

And note that this is bug 20567.  Existing dg-* directive uses in 
gcc.c-torture/execute/ (which are currently ignored) may or may not be 
correct, so they should be reviewed as part of such a migration to decide 
whether they should stay or be removed.  (There aren't that many of them 
to review.)
diff mbox

Patch

	* gcc.c-torture/compile/20000211-1.c (emacs_doprnt_1): Cast return
	value of an undeclared function to the type used in the assignment.
	* gcc.c-torture/compile/20000802-1.c (memcpy): Declare.
	* gcc.c-torture/compile/20020701-1.c (atoi, strchr, strcmp, strlen):
	Wrap in extern "C" for C++.
	(strlen, memcpy): Declare.
	* gcc.c-torture/compile/20021230-1.c (r, t): Declare as
	__INT32_TYPE__.
	* gcc.c-torture/compile/20030219-1.c (clobber_register): Use
	intermediate __UINTPTR_TYPE__ when casting integer to pointer.
	* gcc.c-torture/compile/20060202-1.c (sarray_get_safe): Likewise.
	* gcc.c-torture/compile/pr37878.c (foo): Likewise.
	* gcc.c-torture/compile/20060109-1.c (cb_ident): Declare as
	returning void.
	* gcc.c-torture/compile/20070905-1.c (baz): Cast away volatile
	on second arg when calling f1.
	* gcc.c-torture/compile/20120524-1.c (memcpy): Declare.
	* gcc.c-torture/compile/920428-1.c (x): Use intermediate
	__INTPTR_TYPE__ when casting pointer to integer.
	* gcc.c-torture/compile/920501-21.c (bar): Likewise.
	* gcc.c-torture/compile/pr37387.c (FuncMakeConsequencesPres):
	Likewise.
	* gcc.c-torture/compile/pr60556.c (f): Likewise.
	* gcc.c-torture/compile/920428-2.c (sprintf, fwrite): Remove
	unused declarations.
	* gcc.c-torture/compile/pr46934.c (caller): Use __UINT32_TYPE__
	for argument.
	* gcc.c-torture/compile/pr53058.c (a, b, c): Declare as
	__INT32_TYPE__.
	* gcc.c-torture/compile/pr56984.c (foo): Use __INT32_TYPE__
	for argument.
	* gcc.c-torture/compile/simd-5.c (printf): Declare.
	* gcc.c-torture/execute/20001111-1.c (foo): Use intermediate
	__INTPTR_TYPE__ when casting integer to pointer.
	* gcc.c-torture/execute/20011121-1.c (main): Use intermediate
	__INTPTR_TYPE__ when casting pointer to integer.
	* gcc.c-torture/execute/20030811-1.c (test1, test2, test3,
	test4): Likewise.
	* gcc.c-torture/execute/920428-1.c (x): Likewise.
	* gcc.c-torture/execute/960116-1.c (p): Likewise.
	* gcc.c-torture/execute/loop-2c.c (g, main): Likewise.
	* gcc.c-torture/execute/loop-2d.c (f, main): Likewise.
	* gcc.c-torture/execute/20021120-3.c: Include <stdio.h>.
	* gcc.c-torture/execute/20030606-1.c: Include <string.h>.
	* gcc.c-torture/execute/20031012-1.c: Include <string.h>.
	(memset): Don't declare.
	* gcc.c-torture/execute/20040411-1.c: Include <string.h>.
	* gcc.c-torture/execute/20040423-1.c: Include <string.h>.
	* gcc.c-torture/execute/20121108-1.c (strtoul1): Change second
	arg type to const char **.
	(string_to_ip): Change type of e to constr char *.
	* gcc.c-torture/execute/950221.c (strcpy): Declare.
	* gcc.c-torture/execute/980506-3.c (memset, strlen): Declare.
	* gcc.c-torture/execute/980526-2.c (getname): Use intermediate
	__UINTPTR_TYPE__ when casting pointers to integers.
	* gcc.c-torture/execute/990628-1.c: Include <string.h>.
	* gcc.c-torture/execute/cbrt.c (cbrtl_): Renamed from cbrtl.  All
	callers changed.


diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c
index 7a7c8c0..b593b1b 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c
@@ -84,15 +84,15 @@  emacs_doprnt_1 (Lisp_Object stream, const  Bufbyte *format_nonreloc,
 		Lisp_Object format_reloc, Bytecount format_length,
 		int nargs,
 		const  Lisp_Object *largs)
 {
   int i;
   printf_spec_dynarr *specs = 0;
   format_nonreloc = (( ((  struct Lisp_String  *) ((void *)((((     format_reloc     ) & ((1UL << ((4   * 8 )  - 4 ) ) - 1UL) ) ) | 0x40000000 )) )   )->_data + 0)  ;
   format_length = (( ((  struct Lisp_String  *) ((void *)((((     format_reloc     ) & ((1UL << ((4   * 8 )  - 4 ) ) - 1UL) ) ) | 0x40000000 )) )   )->_size)  ;
-  specs = parse_doprnt_spec (format_nonreloc, format_length);
+  specs = (printf_spec_dynarr *)parse_doprnt_spec (format_nonreloc, format_length);
   for (i = 0; i < (( specs )->cur) ; i++)
     {
       char ch;
       doprnt_1 (stream, (Bufbyte *) &ch, 1, 0, -1, 0, 0);
     }
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000802-1.c b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c
index 0b2f1d6..b4c6ed8 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20000802-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c
@@ -3,13 +3,19 @@  struct foo {
   char b;
   char c;
 };
 
 struct foo bs;
 int x;
 char y[3];
 
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memcpy (void *, const void *, __SIZE_TYPE__);
+
 void bar(void)
 {
     memcpy(bs.a, y, 3);
     bs.a[1] = ((x ? &bs.b : &bs.c) - (char *)&bs) - 2;
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c
index 1258cec..dbd0ebf 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c
@@ -1,19 +1,26 @@ 
 /* PR target/7177
    Problem with cris-axis-elf: ICE in global.
    Origin: hp@axis.com.  */
 
 typedef __SIZE_TYPE__ size_t;
 void f1 (void *);
 char *f2 (const char *);
-int atoi (const char *);
-char *strchr (const char *, int);
-int strcmp (const char *, const char *);
-size_t strlen (const char *);
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int atoi (const char *);
+extern char *strchr (const char *, int);
+extern int strcmp (const char *, const char *);
+extern size_t strlen (const char *);
+extern void *memcpy (void *, const void *, __SIZE_TYPE__);
+#ifdef __cplusplus
+}
+#endif
 typedef enum { A, B, C } t1;
 extern const char _v[];
 
 static t1
 f (const char* p1, const char* p2, char p3)
 {
   char *v1;
   char *v2;
diff --git a/gcc/testsuite/gcc.c-torture/compile/20021230-1.c b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c
index 45ab51f..540eddb 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20021230-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c
@@ -1,8 +1,8 @@ 
 /* SH has special handling for combined and/shift sequences.  Make
    sure that it behaves properly when one input is in the MACL register.  */
-int r, t;
+__INT32_TYPE__ r, t;
 
 static void initRGB()
 {
   t = ((r*255/3) & 0xff) << 16;
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c
index ecc943f..7bb9a81 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c
@@ -1,6 +1,6 @@ 
 int global_one;
 
 void clobber_register()
 {
-  *(volatile unsigned char *)(0xE0000000 * global_one) = 0x00;
+  *(volatile unsigned char *)(__UINTPTR_TYPE__)(0xE0000000 * global_one) = 0x00;
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/20060109-1.c b/gcc/testsuite/gcc.c-torture/compile/20060109-1.c
index 9ef9c2f..69a3248 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20060109-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20060109-1.c
@@ -16,17 +16,17 @@  struct cpp_callbacks
   void (*ident) (cpp_reader *, unsigned int, const cpp_string *);
 };
 static void cb_ident (cpp_reader *, unsigned int, const cpp_string *);
 init_c_lex (void)
 {
   struct cpp_callbacks *cb;
   cb->ident = cb_ident;
 }
-cb_ident (cpp_reader * pfile __attribute__ ((__unused__)), unsigned int
+void cb_ident (cpp_reader * pfile __attribute__ ((__unused__)), unsigned int
 line
           __attribute__ ((__unused__)), const cpp_string * str
           __attribute__ ((__unused__)))
 {
   {
     cpp_string cstr = {
     };
     if (cpp_interpret_string (pfile, str, 1, &cstr, 0))
diff --git a/gcc/testsuite/gcc.c-torture/compile/20060202-1.c b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c
index d16e7b7..aebc3b3 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20060202-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c
@@ -34,17 +34,17 @@  soffset_decode (sidx indx)
   union sofftype x;
   x.idx = indx;
   return x.off.eoffset + (x.off.boffset * (1 << 5));
 }
 static __inline__ void *
 sarray_get_safe (struct sarray *array, sidx indx)
 {
   if (soffset_decode (indx) < array->capacity)
-    return (void *)sarray_get (array, indx);
+    return (void *)(__INTPTR_TYPE__)sarray_get (array, indx);
 }
 void *
 get_imp (Class class, SEL sel)
 {
   void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
   if (res == 0)
     {
 	{
diff --git a/gcc/testsuite/gcc.c-torture/compile/20070905-1.c b/gcc/testsuite/gcc.c-torture/compile/20070905-1.c
index 5953275..92c39b7 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20070905-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20070905-1.c
@@ -8,17 +8,17 @@  struct S
 void f1 (int, unsigned long *);
 int f2 (void);
 int f3 (int, unsigned long *);
 int f4 (int, unsigned long *);
 
 static inline __attribute__ ((always_inline))
 void baz (int x, volatile struct S *y)
 {
-  f1 (x, y->bits);
+  f1 (x, (unsigned long *)y->bits);
 }
 
 static int
 bar (int x, struct S *y)
 {
   int n;
   if (__builtin_constant_p (x) ? f3 (x, y->bits) : f4 (x, y->bits))
     baz (x, y);
diff --git a/gcc/testsuite/gcc.c-torture/compile/20120524-1.c b/gcc/testsuite/gcc.c-torture/compile/20120524-1.c
index 021756b..6ed83a8 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20120524-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20120524-1.c
@@ -1,4 +1,10 @@ 
-  char CJPAT_Packet[1508] = {};
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memcpy (void *, const void *, __SIZE_TYPE__);
+
+char CJPAT_Packet[1508] = {};
 void build_packet(int port, char *packet) {
             memcpy(packet, CJPAT_Packet, sizeof(CJPAT_Packet)); 
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-1.c b/gcc/testsuite/gcc.c-torture/compile/920428-1.c
index fdc478a..8ea1251 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920428-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920428-1.c
@@ -1 +1 @@ 
-x(){char*q;return(long)q>>8&0xff;}
+x(){char*q;return(long)(__INTPTR_TYPE__)q>>8&0xff;}
diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-2.c b/gcc/testsuite/gcc.c-torture/compile/920428-2.c
index f313b32..886ffae 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920428-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920428-2.c
@@ -55,34 +55,32 @@  int rename(const char *from, const char *to);
 struct _iobuf *tmpfile(void);
 char *tmpnam(char *s);
 int setvbuf(struct _iobuf *iop, char *buf, int type, size_t size);
 int setbuf(struct _iobuf *stream, char *buf);
 int setbuffer(struct _iobuf *stream, char *buf, size_t size);
 int setlinebuf(struct _iobuf *stream);
 int fprintf(struct _iobuf *stream, const char *format, ...);
 int printf(const char *format, ...);
-char *sprintf(char *s, const char *format, ...);
 int vfprintf(struct _iobuf *stream, const char *format, va_list arg);
 int vprintf(const char *format, va_list arg);
 int vsprintf(char *s, const char *format, va_list arg);
 int fscanf(struct _iobuf *stream, const char *format, ...);
 int scanf(const char *format, ...);
 int sscanf(char *s, const char *format, ...);
 int fgetc(struct _iobuf *stream);
 int getw(struct _iobuf *stream);
 char *fgets(char *s, int n, struct _iobuf *stream);
 char *gets(char *s);
 int fputc(int c, struct _iobuf *stream);
 int putw(int w, struct _iobuf *stream);
 int fputs(const char *s, struct _iobuf *stream);
 int puts(const char *s);
 int ungetc(int c, struct _iobuf *stream);
 int fread(void *ptr, size_t size, size_t count, struct _iobuf *iop);
-int fwrite(const void *ptr, size_t size, size_t count, struct _iobuf *iop);
 int fseek(struct _iobuf *stream, long offset, int ptrname);
 long ftell(struct _iobuf *stream);
 void rewind(struct _iobuf *stream);
 int fgetpos(struct _iobuf *stream, long *pos);
 int fsetpos(struct _iobuf *stream, const long *pos);
 void perror(const char *s);
 typedef unsigned char byte;
 typedef unsigned char uchar;
diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-21.c b/gcc/testsuite/gcc.c-torture/compile/920501-21.c
index 4a9f05a..044b36f 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920501-21.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920501-21.c
@@ -1,3 +1,3 @@ 
 typedef unsigned short t;
 struct foo{t d;};
-int bar(d)t d;{struct foo u;u.d=d;return(int)(&u);}
+int bar(d)t d;{struct foo u;u.d=d;return(int)(__INTPTR_TYPE__)(&u);}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37387.c b/gcc/testsuite/gcc.c-torture/compile/pr37387.c
index d338933..a64bc32 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr37387.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37387.c
@@ -1,11 +1,11 @@ 
 typedef long int Int;
 void FuncMakeConsequencesPres (long *objDefs1)
 {
-  long a = (long)objDefs1;
+  long a = (long)(__INTPTR_TYPE__)objDefs1;
   int c = a & 0x01;
   int b = 0;
   if (!  ( 13 <= ( c ? 0 : (((int) objDefs1 & 0x02) ? 0 : *objDefs1  ))
            && b <= 0))
     ErrorQuit ();
 }
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37878.c b/gcc/testsuite/gcc.c-torture/compile/pr37878.c
index aa18e6d..bd0b356 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr37878.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37878.c
@@ -1,9 +1,9 @@ 
 /* PR target/37878 */
 
 double y, z;
 void foo (long x)
 {
-  y = *(double *) ((long *) (x - 1) + 1);
-  z = *(double *) ((long *) (x - 1) + 1);
+  y = *(double *) ((long *) (__INTPTR_TYPE__) (x - 1) + 1);
+  z = *(double *) ((long *) (__INTPTR_TYPE__) (x - 1) + 1);
 }
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46934.c b/gcc/testsuite/gcc.c-torture/compile/pr46934.c
index a9c0b68..b634e00 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr46934.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr46934.c
@@ -1,9 +1,9 @@ 
-int caller (unsigned int reg_type)
+int caller (__UINT32_TYPE__ reg_type)
 {
   switch (reg_type)
     {
     case 0x80000000:
       return (int)foo();
 
     case 0x80000003:
       return (int) bar();
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53058.c b/gcc/testsuite/gcc.c-torture/compile/pr53058.c
index 90063c5..6bcd18e 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr53058.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr53058.c
@@ -1,11 +1,11 @@ 
 /* PR tree-optimization/53058 */
 
-int a, b, c;
+__INT32_TYPE__ a, b, c;
 
 void
 foo ()
 {
   c = b >> 16;
   if (c > 32767)
     c = 0;
   a = b;
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr56984.c b/gcc/testsuite/gcc.c-torture/compile/pr56984.c
index bd00bee..fe94635 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr56984.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr56984.c
@@ -1,9 +1,9 @@ 
 /* PR tree-optimization/56984 */
 
 int
-foo (int x)
+foo (__INT32_TYPE__ x)
 {
   if ((x >> 31) < -1)
     x++;
   return x;
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr60556.c b/gcc/testsuite/gcc.c-torture/compile/pr60556.c
index c775432..c1565e1 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr60556.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr60556.c
@@ -1,8 +1,8 @@ 
 /* PR middle-end/60556 */
 
 int g (int);
 
 unsigned long long f (void)
 {
- return (unsigned long long)(long)&g;
+ return (unsigned long long)(__INTPTR_TYPE__)&g;
 }
diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.c b/gcc/testsuite/gcc.c-torture/compile/simd-5.c
index 016cccd..837e647 100644
--- a/gcc/testsuite/gcc.c-torture/compile/simd-5.c
+++ b/gcc/testsuite/gcc.c-torture/compile/simd-5.c
@@ -1,10 +1,12 @@ 
 #define vector64 __attribute__((vector_size(8)))
 
+extern __SIZE_TYPE__ printf (const char *, ...);
+
 main(){
 
  vector64 int  c;
 vector64 int a = {1, -1};
 vector64 int b = {2, -2};
 c = -a + b*b*(-1LL);
 /* c is now {5, 3} */
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/20001111-1.c b/gcc/testsuite/gcc.c-torture/execute/20001111-1.c
index 85617c2..44e2697 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20001111-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20001111-1.c
@@ -11,17 +11,17 @@  foo (unsigned int offset)
   int x;
   char *data;
 
   i = u;
   if (i)
     return i * 0xce2f;
 
   buffer = next_buffer;
-  data = buffer * 0xce2f;
+  data = (char *)(__INTPTR_TYPE__)(buffer * 0xce2f);
   for (i = 0; i < 2; i++)
     bar ();
   buffer = next_buffer;
   return buffer * 0xce2f + offset;
 
 }
 
 void
diff --git a/gcc/testsuite/gcc.c-torture/execute/20011121-1.c b/gcc/testsuite/gcc.c-torture/execute/20011121-1.c
index 3e3d03a..c61984b 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20011121-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20011121-1.c
@@ -7,13 +7,13 @@  struct s
 
 struct s s1;
 
 int
 main()
 {
   struct s s2;
   s2.b[0] = 100;
-  __builtin_memcpy(&s2, &s1, ((unsigned int) &((struct s *)0)->b));
+  __builtin_memcpy(&s2, &s1, ((unsigned int) (__INTPTR_TYPE__) &((struct s *)0)->b));
   if (s2.b[0] != 100)
     abort();
   exit(0);
 }
diff --git a/gcc/testsuite/gcc.c-torture/execute/20021120-3.c b/gcc/testsuite/gcc.c-torture/execute/20021120-3.c
index e875f1f..d9a8060 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20021120-3.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20021120-3.c
@@ -1,11 +1,14 @@ 
 /* Test whether a partly call-clobbered register will be moved over a call.
    Although the original test case didn't use any GNUisms, it proved
    difficult to reduce without the named register extension.  */
+
+#include <stdio.h>
+
 #if __SH64__ == 32
 #define LOC asm ("r10")
 #else
 #define LOC
 #endif
 
 unsigned int foo (char *c, unsigned int x, unsigned int y)
 {
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030606-1.c b/gcc/testsuite/gcc.c-torture/execute/20030606-1.c
index 51054d9..085685e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20030606-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20030606-1.c
@@ -1,8 +1,9 @@ 
+#include <string.h>
 
 int * foo (int *x, int b)
 {
 
   *(x++) = 55;
   if (b)
     *(x++) = b;
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030811-1.c b/gcc/testsuite/gcc.c-torture/execute/20030811-1.c
index 2ac59c0..88ab8d1 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20030811-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20030811-1.c
@@ -4,32 +4,32 @@  void vararg (int i, ...)
 {
   (void) i;
 }
 
 int i0[0], i1;
 
 void test1 (void)
 {
-  int a = (int) (long long) __builtin_return_address (0);
+  int a = (int) (__INTPTR_TYPE__) __builtin_return_address (0);
   vararg (0, a);
 }
 
 void test2 (void)
 {
-  i0[0] = (int) (long long) __builtin_return_address (0);
+  i0[0] = (int) (__INTPTR_TYPE__) __builtin_return_address (0);
 }
 
 void test3 (void)
 {
-  i1 = (int) (long long) __builtin_return_address (0);
+  i1 = (int) (__INTPTR_TYPE__) __builtin_return_address (0);
 }
 
 void test4 (void)
 {
-  volatile long long a = (long long) __builtin_return_address (0);
+  volatile long long a = (long long)(__INTPTR_TYPE__) __builtin_return_address (0);
   i0[0] = (int) a;
 }
 
 int main (void)
 {
   return 0;
 }
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031012-1.c b/gcc/testsuite/gcc.c-torture/execute/20031012-1.c
index a1f3de8..a7cdd38 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20031012-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20031012-1.c
@@ -6,17 +6,18 @@ 
 #if defined(STACK_SIZE) && STACK_SIZE < 16000
 #define ARRAY_SIZE (STACK_SIZE / 2)
 #define STRLEN	   (ARRAY_SIZE - 9)
 #else
 #define ARRAY_SIZE 15000
 #define STRLEN     13371
 #endif
 
-extern void *memset (void *, int, __SIZE_TYPE__);
+#include <string.h>
+
 extern void abort (void);
 
 static void foo ()
 {
     char a[ARRAY_SIZE];
 
     a[0]=0;
     memset( &a[0], 0xCD, STRLEN );
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040411-1.c b/gcc/testsuite/gcc.c-torture/execute/20040411-1.c
index 8db4562..bcceb45 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20040411-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20040411-1.c
@@ -1,8 +1,10 @@ 
+#include <string.h>
+
 int
 sub1 (int i, int j)
 {
   typedef int c[i+2];
   int x[10], y[10];
 
   if (j == 2)
     {
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040423-1.c b/gcc/testsuite/gcc.c-torture/execute/20040423-1.c
index ace797e..e69d3d0 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20040423-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20040423-1.c
@@ -1,8 +1,10 @@ 
+#include <string.h>
+
 int
 sub1 (int i, int j)
 {
   typedef struct
   {
    int  c[i+2];
   }c;
   int x[10], y[10];
diff --git a/gcc/testsuite/gcc.c-torture/execute/20121108-1.c b/gcc/testsuite/gcc.c-torture/execute/20121108-1.c
index 5ec889e..064cd0d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20121108-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20121108-1.c
@@ -1,13 +1,13 @@ 
 char temp[] = "192.168.190.160";
 unsigned result = (((((192u<<8)|168u)<<8)|190u)<<8)|160u;
 
-int strtoul1(const char *a, char **b, int c) __attribute__((noinline, noclone));
-int strtoul1(const char *a, char **b, int c)
+int strtoul1(const char *a, const char **b, int c) __attribute__((noinline, noclone));
+int strtoul1(const char *a, const char **b, int c)
 {
   *b = a+3;
   if (a == temp)
     return 192;
   else if (a == temp+4)
     return 168;
   else if (a == temp+8)
     return 190;
@@ -15,17 +15,17 @@  int strtoul1(const char *a, char **b, int c)
     return 160;
   __builtin_abort();
 }
 
 int string_to_ip(const char *s) __attribute__((noinline,noclone));
 int string_to_ip(const char *s)
 {
         int addr;
-        char *e;
+        const char *e;
         int i;
 
         if (s == 0)
                 return(0);
 
         for (addr=0, i=0; i<4; ++i) {
                 int val = s ? strtoul1(s, &e, 10) : 0;
                 addr <<= 8;
diff --git a/gcc/testsuite/gcc.c-torture/execute/920428-1.c b/gcc/testsuite/gcc.c-torture/execute/920428-1.c
index 154af76..6094b6d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/920428-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/920428-1.c
@@ -1,2 +1,11 @@ 
-x(const char*s){char a[1];const char*ss=s;a[*s++]|=1;return(int)ss+1==(int)s;}
-main(){if(x("")!=1)abort();exit(0);}
+x(const char*s)
+{
+  char a[1];
+  const char *ss=s;
+  a[*s++]|=1;
+  return (int)(__INTPTR_TYPE__)ss+1==(int)(__INTPTR_TYPE__)s;
+}
+main()
+{
+  if(x("")!=1)abort();exit(0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/950221-1.c b/gcc/testsuite/gcc.c-torture/execute/950221-1.c
index d67da5b..4d4b32d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/950221-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/950221-1.c
@@ -1,8 +1,9 @@ 
+extern char *strcpy (char *, const char *);
 struct parsefile
 {
   long fd;
   char *buf;
 };
 struct parsefile basepf;
 struct parsefile *parsefile = &basepf;
 #ifdef STACK_SIZE
diff --git a/gcc/testsuite/gcc.c-torture/execute/960116-1.c b/gcc/testsuite/gcc.c-torture/execute/960116-1.c
index 6d7624c..0f6640d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/960116-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/960116-1.c
@@ -1,12 +1,12 @@ 
 static inline
 p (int *p)
 {
-  return !((long) p & 1);
+  return !((long) (__INTPTR_TYPE__)p & 1);
 }
 
 int
 f (int *q)
 {
   if (p (q) && *q)
     return 1;
   return 0;
diff --git a/gcc/testsuite/gcc.c-torture/execute/980506-3.c b/gcc/testsuite/gcc.c-torture/execute/980506-3.c
index a943e9a..c596538 100644
--- a/gcc/testsuite/gcc.c-torture/execute/980506-3.c
+++ b/gcc/testsuite/gcc.c-torture/execute/980506-3.c
@@ -1,9 +1,11 @@ 
 unsigned char lookup_table [257];
+extern void *memset (void *, int, __SIZE_TYPE__);
+extern __SIZE_TYPE__ strlen (const char *);
 
 static int 
 build_lookup (pattern)
      unsigned char *pattern;
 {
   int m;
 
   m = strlen (pattern) - 1;
diff --git a/gcc/testsuite/gcc.c-torture/execute/980526-2.c b/gcc/testsuite/gcc.c-torture/execute/980526-2.c
index c17f4ea..566b640 100644
--- a/gcc/testsuite/gcc.c-torture/execute/980526-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/980526-2.c
@@ -20,26 +20,26 @@  void do_mknod(const char * filename, int mode, kdev_t dev)
 	else
 		abort();
 }
 
 
 char * getname(const char * filename)
 {
 	register unsigned int a1,a2,a3,a4,a5,a6,a7,a8,a9;
-	a1 = (unsigned int)(filename) *5 + 1;
-	a2 = (unsigned int)(filename) *6 + 2;
-	a3 = (unsigned int)(filename) *7 + 3;
-	a4 = (unsigned int)(filename) *8 + 4;
-	a5 = (unsigned int)(filename) *9 + 5;
-	a6 = (unsigned int)(filename) *10 + 5;
-	a7 = (unsigned int)(filename) *11 + 5;
-	a8 = (unsigned int)(filename) *12 + 5;
-	a9 = (unsigned int)(filename) *13 + 5;
-	return (char *)(a1*a2+a3*a4+a5*a6+a7*a8+a9);
+	a1 = (unsigned int)(__UINTPTR_TYPE__)(filename) *5 + 1;
+	a2 = (unsigned int)(__UINTPTR_TYPE__)(filename) *6 + 2;
+	a3 = (unsigned int)(__UINTPTR_TYPE__)(filename) *7 + 3;
+	a4 = (unsigned int)(__UINTPTR_TYPE__)(filename) *8 + 4;
+	a5 = (unsigned int)(__UINTPTR_TYPE__)(filename) *9 + 5;
+	a6 = (unsigned int)(__UINTPTR_TYPE__)(filename) *10 + 5;
+	a7 = (unsigned int)(__UINTPTR_TYPE__)(filename) *11 + 5;
+	a8 = (unsigned int)(__UINTPTR_TYPE__)(filename) *12 + 5;
+	a9 = (unsigned int)(__UINTPTR_TYPE__)(filename) *13 + 5;
+	return (char *)(__UINTPTR_TYPE__)(a1*a2+a3*a4+a5*a6+a7*a8+a9);
 }
 
 int sys_mknod(const char * filename, int mode, dev_t dev)
 {
 	int error;
 	char * tmp;
 
 	tmp = getname(filename);
diff --git a/gcc/testsuite/gcc.c-torture/execute/990628-1.c b/gcc/testsuite/gcc.c-torture/execute/990628-1.c
index e010510..129f5c9 100644
--- a/gcc/testsuite/gcc.c-torture/execute/990628-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/990628-1.c
@@ -1,9 +1,10 @@ 
 #include <stdlib.h>
+#include <string.h>
 
 struct {
     long sqlcode;
 } sqlca;
 
 
 struct data_record {
     int dummy;
diff --git a/gcc/testsuite/gcc.c-torture/execute/cbrt.c b/gcc/testsuite/gcc.c-torture/execute/cbrt.c
index 8659cc7..6ebceaf 100644
--- a/gcc/testsuite/gcc.c-torture/execute/cbrt.c
+++ b/gcc/testsuite/gcc.c-torture/execute/cbrt.c
@@ -17,17 +17,17 @@  static const unsigned long
 static const double
 	C =  5.42857142857142815906e-01, /* 19/35     = 0x3FE15F15, 0xF15F15F1 */
 	D = -7.05306122448979611050e-01, /* -864/1225 = 0xBFE691DE, 0x2532C834 */
 	E =  1.41428571428571436819e+00, /* 99/70     = 0x3FF6A0EA, 0x0EA0EA0F */
 	F =  1.60714285714285720630e+00, /* 45/28     = 0x3FF9B6DB, 0x6DB6DB6E */
 	G =  3.57142857142857150787e-01; /* 5/14      = 0x3FD6DB6D, 0xB6DB6DB7 */
 
 double
-cbrtl (double x)
+cbrtl_ (double x)
 {
   long hx;
   double r,s,w;
   double lt;
   unsigned sign;
   typedef unsigned unsigned32 __attribute__((mode(SI)));
   union {
     double t;
@@ -77,16 +77,16 @@  cbrtl (double x)
 
   lt = ut.t;
   lt -= (lt - (x/(lt*lt))) * 0.333333333333333333333;
   return lt;
 }
 
 main ()
 {
-  if ((int) (cbrtl (27.0) + 0.5) != 3)
+  if ((int) (cbrtl_ (27.0) + 0.5) != 3)
     abort ();
 
   exit (0);
 }
 #else
 main () { exit (0); }
 #endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2c.c b/gcc/testsuite/gcc.c-torture/execute/loop-2c.c
index 9facf3b..5b37f91 100644
--- a/gcc/testsuite/gcc.c-torture/execute/loop-2c.c
+++ b/gcc/testsuite/gcc.c-torture/execute/loop-2c.c
@@ -5,19 +5,19 @@  __inline__ f (b, o)
   unsigned int i;
   int *p;
   for (p = &a[b], i = b; --i < ~0; )
     *--p = i * 3 + o;
 }
 
 g(int b)
 {
-  f (b, (int)a);
+  f (b, (int)(__INTPTR_TYPE__)a);
 }
 
 main ()
 {
   a[0] = a[1] = 0;
   g (2);
-  if (a[0] != (int)a || a[1] != (int)a + 3)
+  if (a[0] != (int)(__INTPTR_TYPE__)a || a[1] != (int)(__INTPTR_TYPE__)a + 3)
     abort ();
   exit (0);
 }
diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2d.c b/gcc/testsuite/gcc.c-torture/execute/loop-2d.c
index 19272bf..d49787f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/loop-2d.c
+++ b/gcc/testsuite/gcc.c-torture/execute/loop-2d.c
@@ -1,18 +1,18 @@ 
 int a[2];
 
 f (b)
 {
   unsigned int i;
   int *p;
   for (p = &a[b], i = b; --i < ~0; )
-    *--p = i * 3 + (int)a;
+    *--p = i * 3 + (int)(__INTPTR_TYPE__)a;
 }
 
 main ()
 {
   a[0] = a[1] = 0;
   f (2);
-  if (a[0] != (int)a || a[1] != (int)a + 3)
+  if (a[0] != (int)(__INTPTR_TYPE__)a || a[1] != (int)(__INTPTR_TYPE__)a + 3)
     abort ();
   exit (0);
 }