* 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.
@@ -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);
}
}
@@ -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;
}
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -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))
@@ -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)
{
{
@@ -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);
@@ -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));
}
@@ -1 +1 @@
-x(){char*q;return(long)q>>8&0xff;}
+x(){char*q;return(long)(__INTPTR_TYPE__)q>>8&0xff;}
@@ -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;
@@ -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);}
@@ -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 ();
}
@@ -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);
}
@@ -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();
@@ -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;
@@ -1,9 +1,9 @@
/* PR tree-optimization/56984 */
int
-foo (int x)
+foo (__INT32_TYPE__ x)
{
if ((x >> 31) < -1)
x++;
return x;
}
@@ -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;
}
@@ -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} */
@@ -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
@@ -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);
}
@@ -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)
{
@@ -1,8 +1,9 @@
+#include <string.h>
int * foo (int *x, int b)
{
*(x++) = 55;
if (b)
*(x++) = b;
@@ -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;
}
@@ -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 );
@@ -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)
{
@@ -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];
@@ -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;
@@ -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);
+}
@@ -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
@@ -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;
@@ -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;
@@ -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);
@@ -1,9 +1,10 @@
#include <stdlib.h>
+#include <string.h>
struct {
long sqlcode;
} sqlca;
struct data_record {
int dummy;
@@ -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
@@ -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);
}
@@ -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);
}