diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.c-torture/compile | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile')
1191 files changed, 25399 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000105-1.c b/gcc/testsuite/gcc.c-torture/compile/20000105-1.c new file mode 100644 index 000000000..6f389d88b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000105-1.c @@ -0,0 +1,27 @@ +main(int na, char* argv[]) +{ + int wflg = 0, tflg = 0; + int dflg = 0; + exit(0); + while(1) + { + switch(argv[1][0]) + { + help: + exit(0); + case 'w': + case 'W': + wflg = 1; + break; + case 't': + case 'T': + tflg = 1; + break; + case 'd': + dflg = 1; + break; + } + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000105-2.c b/gcc/testsuite/gcc.c-torture/compile/20000105-2.c new file mode 100644 index 000000000..7689395f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000105-2.c @@ -0,0 +1,5 @@ +foo () +{ + long long int i = (int) ""; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000120-1.c b/gcc/testsuite/gcc.c-torture/compile/20000120-1.c new file mode 100644 index 000000000..99843933b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000120-1.c @@ -0,0 +1,13 @@ +extern char letters[26+1]; +char letter; +int letter_number; +char letters[] = "AbCdefghiJklmNopQrStuVwXyZ"; + +static void +pad_home1 () +{ + letter = letters[letter_number = + letters[letter_number + 1] ? letter_number + + 1 : 0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000120-2.c b/gcc/testsuite/gcc.c-torture/compile/20000120-2.c new file mode 100644 index 000000000..737eb92ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000120-2.c @@ -0,0 +1,18 @@ +extern __inline__ int +odd(int i) +{ + return i & 0x1; +} + +int +foo(int i, int j) +{ + return odd(i + j); +} + +int +odd(int i) +{ + return i & 0x1; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000127-1.c b/gcc/testsuite/gcc.c-torture/compile/20000127-1.c new file mode 100644 index 000000000..34b173c68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000127-1.c @@ -0,0 +1,7 @@ +double bar(void), c; +int foo(void) { + double a, b; + int i = bar() + bar(); + a = i; i += 1; a += 0.1; i = c + i; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c new file mode 100644 index 000000000..7a7c8c0cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c @@ -0,0 +1,98 @@ +typedef __SIZE_TYPE__ size_t; +typedef unsigned char Bufbyte; +typedef int Bytecount; +typedef int Charcount; +typedef struct lstream Lstream; +typedef int Lisp_Object; +extern Lisp_Object Qnil; +extern inline int +TRUE_LIST_P (Lisp_Object object) +{ + return (( object ) == ( Qnil )) ; +} +struct Lisp_String +{ + Bytecount _size; + Bufbyte *_data; +}; +typedef enum lstream_buffering +{ + LSTREAM_LINE_BUFFERED, +} Lstream_buffering; +struct lstream +{ + Lstream_buffering buffering; + unsigned char *out_buffer; + size_t out_buffer_size; + size_t out_buffer_ind; + size_t byte_count; + long flags; + char data[1]; +}; +typedef struct printf_spec printf_spec; +struct printf_spec +{ +}; +typedef union printf_arg printf_arg; +union printf_arg +{ +}; +typedef struct +{ + int cur; +} printf_spec_dynarr; +typedef struct +{ +} printf_arg_dynarr; +static void +doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len, + Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag) +{ + Charcount cclen; + Bufbyte pad; + Lstream *lstr = (( struct lstream *) ((void *)(((( stream ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) ; + cclen = ( len ) ; + if (zero_flag) + pad = '0'; + pad = ' '; +#if 0 + if (minlen > cclen && !minus_flag) +#endif + { + int to_add = minlen - cclen; + while (to_add > 0) + { + (( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; + to_add--; + } + } + if (maxlen >= 0) + len = ( ((( maxlen ) <= ( cclen )) ? ( maxlen ) : ( cclen )) ) ; + Lstream_write (lstr, string, len); + if (minlen > cclen && minus_flag) + { + int to_add = minlen - cclen; + while (to_add > 0) + { + (( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; + to_add--; + } + } +} +static Bytecount +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); + 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/20000211-3.c b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c new file mode 100644 index 000000000..7a02b685c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c @@ -0,0 +1,10 @@ +void f_clos(int x) + +{ + switch(x) { + default: + mumble:; + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000224-1.c b/gcc/testsuite/gcc.c-torture/compile/20000224-1.c new file mode 100644 index 000000000..1c72b6acc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000224-1.c @@ -0,0 +1,41 @@ +enum Lisp_Type +{ + Lisp_Int + ,Lisp_Record + ,Lisp_Cons + ,Lisp_String + ,Lisp_Vector + ,Lisp_Symbol + ,Lisp_Char +}; +typedef +union Lisp_Object + { + struct + { + enum Lisp_Type type: 3L ; + unsigned long markbit: 1; + unsigned long val: 32; + } gu; + long i; + } +Lisp_Object; +extern int initialized; +void +init_device_faces (int *d) +{ + if (initialized) + { + Lisp_Object tdevice; + do { + tdevice = (union Lisp_Object) + { gu: + { markbit: 0, + type: Lisp_Record, + val: ((unsigned long )d) + } + }; + } while (0); + call_critical_lisp_code (tdevice); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000314-1.c b/gcc/testsuite/gcc.c-torture/compile/20000314-1.c new file mode 100644 index 000000000..26c13a7d6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000314-1.c @@ -0,0 +1,11 @@ +struct { + char a[5]; +} *p; + +int main () +{ + int i = -1; + + if(p->a[-i]) + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000314-2.c b/gcc/testsuite/gcc.c-torture/compile/20000314-2.c new file mode 100644 index 000000000..3fdb3c3a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000314-2.c @@ -0,0 +1,6 @@ +extern void malloc(__SIZE_TYPE__ size); + +toto() +{ + malloc(100); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000319-1.c b/gcc/testsuite/gcc.c-torture/compile/20000319-1.c new file mode 100644 index 000000000..db00e4f01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000319-1.c @@ -0,0 +1,6 @@ +struct foo +{ + long x; + char y; + long boom[0]; +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20000326-1.c b/gcc/testsuite/gcc.c-torture/compile/20000326-1.c new file mode 100644 index 000000000..71ed149c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000326-1.c @@ -0,0 +1,23 @@ +long sys_reboot(int magic1, int magic2, int cmd, void * arg) +{ + switch (cmd) { + case 0x89ABCDEF: + break; + + case 0x00000000: + break; + + case 0xCDEF0123: + break; + + case 0x4321FEDC: + break; + + case 0xA1B2C3D4: + break; + + default: + break; + }; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000326-2.c b/gcc/testsuite/gcc.c-torture/compile/20000326-2.c new file mode 100644 index 000000000..055260f6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000326-2.c @@ -0,0 +1,13 @@ +#ifndef NO_LABEL_VALUES +extern int printk(const char *fmt, ...); + +void foo (int x, int y) +{ + __label__ here; + here: + printk ("", &&here); +} + +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20000329-1.c b/gcc/testsuite/gcc.c-torture/compile/20000329-1.c new file mode 100644 index 000000000..547bf96f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000329-1.c @@ -0,0 +1,40 @@ +int giop_tx_big_endian; + +inline +void +giop_encode_ulong (unsigned long i, char *buf) +{ + if (giop_tx_big_endian) + { + *(unsigned long *) buf = i; + } + else + { + *buf++ = i & 0xff; + *buf++ = (i >> 8) & 0xff; + *buf++ = (i >> 16) & 0xff; + *buf = (i >> 24) & 0xff; + } +} + + + +static +double +time_giop_encode (unsigned long l) +{ + int c; + char buf[4]; + + for (c = 0; c < (512 * 1024 * 1024); ++c) + { + giop_encode_ulong (l, buf); + } +} + +int +main (int ac, char *av[]) +{ + giop_tx_big_endian = 1; + time_giop_encode (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000403-1.c b/gcc/testsuite/gcc.c-torture/compile/20000403-1.c new file mode 100644 index 000000000..27345b56f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000403-1.c @@ -0,0 +1,18 @@ +struct utsname { + char sysname[32 ]; + char version[32 ]; +}; +int +uname(name) + struct utsname *name; +{ + int mib[2], rval; + long len; + char *p; + int oerrno; + if (sysctl(mib, 2, &name->sysname, &len, 0 , 0) == -1) + ; + for (p = name->version; len--; ++p) { + *p = ' '; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000403-2.c b/gcc/testsuite/gcc.c-torture/compile/20000403-2.c new file mode 100644 index 000000000..c793a49fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000403-2.c @@ -0,0 +1,6 @@ +void +foo () +{ + long long tmp; + (( tmp ) = (long long)( tmp ) >> ( 32 )) ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-1.c b/gcc/testsuite/gcc.c-torture/compile/20000405-1.c new file mode 100644 index 000000000..64dd2e168 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000405-1.c @@ -0,0 +1,13 @@ +// Copyright (C) 2000 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// simplified from libio/floatconv.c + +static const double bar[] = { 0 }; +int j; + +double +foo () +{ + return bar[j]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-2.c b/gcc/testsuite/gcc.c-torture/compile/20000405-2.c new file mode 100644 index 000000000..0b8559f14 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000405-2.c @@ -0,0 +1,6 @@ +extern void foo (int); + +void bar (unsigned long l) +{ + foo(l == 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-3.c b/gcc/testsuite/gcc.c-torture/compile/20000405-3.c new file mode 100644 index 000000000..c2e88339e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000405-3.c @@ -0,0 +1,9 @@ +struct foo { + void *entry[40]; +} __attribute__ ((aligned(32))); + +int foo (struct foo *ptr, int idx, void *pointer) +{ + ptr->entry[idx] = pointer; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000412-1.c b/gcc/testsuite/gcc.c-torture/compile/20000412-1.c new file mode 100644 index 000000000..243b469e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000412-1.c @@ -0,0 +1,16 @@ +typedef struct { + short a; + short b; +} s1; + +extern void g(unsigned char *b); + +void f(void) +{ + s1 a; + unsigned char *b; + + a.a = 0; + b = (unsigned char *)&a; + g(b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000412-2.c b/gcc/testsuite/gcc.c-torture/compile/20000412-2.c new file mode 100644 index 000000000..e76a1eb73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000412-2.c @@ -0,0 +1,4 @@ +char list[250][64]; + +int f(int idx) { return (strlen(list[idx])); } + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000420-1.c b/gcc/testsuite/gcc.c-torture/compile/20000420-1.c new file mode 100644 index 000000000..552f02e42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000420-1.c @@ -0,0 +1,19 @@ +struct z_candidate { struct z_candidate *next;int viable;}; +int pedantic; + +static struct z_candidate * +splice_viable (cands) + struct z_candidate *cands; +{ + struct z_candidate **p = &cands; + + for (; *p; ) + { + if (pedantic ? (*p)->viable == 1 : (*p)->viable) + p = &((*p)->next); + else + *p = (*p)->next; + } + + return cands; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000420-2.c b/gcc/testsuite/gcc.c-torture/compile/20000420-2.c new file mode 100644 index 000000000..2d825f019 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000420-2.c @@ -0,0 +1,11 @@ +struct x { int a, b, c; }; + +extern struct x a (); +extern void b (struct x); + +void +foo () +{ + a (); + b (a ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000427-1.c b/gcc/testsuite/gcc.c-torture/compile/20000427-1.c new file mode 100644 index 000000000..dc51419cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000427-1.c @@ -0,0 +1,9 @@ +int lwidth; +int lheight; +void ConvertFor3dDriver (int requirePO2, int maxAspect) +{ + int oldw = lwidth, oldh = lheight; + + lheight = FindNearestPowerOf2 (lheight); + while (lwidth/lheight > maxAspect) lheight += lheight; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000502-1.c b/gcc/testsuite/gcc.c-torture/compile/20000502-1.c new file mode 100644 index 000000000..fcf7899a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000502-1.c @@ -0,0 +1,17 @@ +static int minimum(int a, int b) +{ + if(a < b) + return a; + else + return b; +} +static int a, b; +static inline int foo(void) +{ + a = minimum (a, b); + return 0; +} +static int bar(void) +{ + return foo(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000504-1.c b/gcc/testsuite/gcc.c-torture/compile/20000504-1.c new file mode 100644 index 000000000..1941bb34d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000504-1.c @@ -0,0 +1,15 @@ +struct foo { + int a; + int b; +}; + +int func(struct foo *foo, int a) +{ + if (foo->b == 0) { + int ret = foo->a = a; + if (a >= 0) + foo->a = a; + return (ret); + } + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000511-1.c b/gcc/testsuite/gcc.c-torture/compile/20000511-1.c new file mode 100644 index 000000000..11c131522 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000511-1.c @@ -0,0 +1,31 @@ +typedef struct { + char y; + char x[32]; +} X; + +int z (void) +{ + X xxx; + xxx.x[0] = + xxx.x[31] = '0'; + xxx.y = 0xf; + return f (xxx, xxx); +} + +int main (void) +{ + int val; + + val = z (); + if (val != 0x60) + abort (); + exit (0); +} + +int f(X x, X y) +{ + if (x.y != y.y) + return 'F'; + + return x.x[0] + y.x[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000517-1.c b/gcc/testsuite/gcc.c-torture/compile/20000517-1.c new file mode 100644 index 000000000..903e61eef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000517-1.c @@ -0,0 +1,9 @@ +void test2 (int*, int, int, int); + +void test () +{ + int l; + + test2 (0, 0, 0, 0); + test2 (&l, 0, 0, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c new file mode 100644 index 000000000..d2087796a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c @@ -0,0 +1,17 @@ +void callit1(void*); + +extern __inline__ void test() +{ + __label__ l1; + + callit1(&&l1); + +l1:; + +} + + +void dotest() +{ + test(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000523-1.c b/gcc/testsuite/gcc.c-torture/compile/20000523-1.c new file mode 100644 index 000000000..eab4a9c42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000523-1.c @@ -0,0 +1,5 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva <aoliva@cygnus.com> */ + +enum { foo = sizeof(void *) }; +int i = sizeof(void *); diff --git a/gcc/testsuite/gcc.c-torture/compile/20000605-1.c b/gcc/testsuite/gcc.c-torture/compile/20000605-1.c new file mode 100644 index 000000000..1fe588234 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000605-1.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation */ + +/* make sure we don't get confused by various flavors of void */ + +/* Origin: Jakub Jelinek <jakub@redhat.com> + * Joel Sherrill <joel.sherrill@OARcorp.com> + */ + +typedef void foo; +foo bar(void); +void baz(void) +{ + bar(); +} + +void volatile f(); + +int x() +{ + f(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000606-1.c b/gcc/testsuite/gcc.c-torture/compile/20000606-1.c new file mode 100644 index 000000000..93977c093 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000606-1.c @@ -0,0 +1,10 @@ +typedef struct _foo foo; +extern foo bar; +struct _foo { + int a; +}; + +void baz(void) +{ + bar.a = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000609-1.c b/gcc/testsuite/gcc.c-torture/compile/20000609-1.c new file mode 100644 index 000000000..f03aa35a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000609-1.c @@ -0,0 +1,6 @@ +int main () +{ + char temp[1024] = "tempfile"; + return temp[0] != 't'; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000629-1.c b/gcc/testsuite/gcc.c-torture/compile/20000629-1.c new file mode 100644 index 000000000..58b522ed8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000629-1.c @@ -0,0 +1,28 @@ +struct a +{ + struct a * x; +}; + +void +foo (struct a * b) +{ + int i; + + for (i = 0; i < 1000; i++) + { + b->x = b; + b++; + } +} + +void +bar (struct a * b) +{ + int i; + + for (i = 0; i < 1000; i++) + { + b->x = b; + b--; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000701-1.c b/gcc/testsuite/gcc.c-torture/compile/20000701-1.c new file mode 100644 index 000000000..2f1e73157 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000701-1.c @@ -0,0 +1,19 @@ +void +dr106_1(void *pv, int i) +{ + *pv; + i ? *pv : *pv; + *pv, *pv; +} + +void +dr106_2(const void *pcv, volatile void *pvv, int i) +{ + *pcv; + i ? *pcv : *pcv; + *pcv, *pcv; + + *pvv; + i ? *pvv : *pvv; + *pvv, *pvv; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000717-1.c b/gcc/testsuite/gcc.c-torture/compile/20000717-1.c new file mode 100644 index 000000000..9a0c747ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000717-1.c @@ -0,0 +1,11 @@ +short +inner_product (short *a, short *b) +{ + int i; + short sum = 0; + + for (i = 9; i >= 0; i--) + sum += (*a++) * (*b++); + + return sum; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000718.c b/gcc/testsuite/gcc.c-torture/compile/20000718.c new file mode 100644 index 000000000..acabaf160 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000718.c @@ -0,0 +1,14 @@ +extern double foo(double, double); +extern void bar(float*, int*); + +void +baz(int* arg) +{ + float tmp = (float)foo(2.0,1.0); + unsigned i; + short junk[64]; + + for (i=0; i<10; i++, arg++) { + bar(&tmp, arg); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000728-1.c b/gcc/testsuite/gcc.c-torture/compile/20000728-1.c new file mode 100644 index 000000000..f56d94083 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000728-1.c @@ -0,0 +1,16 @@ +struct clock { + long sec; long usec; +}; + +int foo(void) +{ + struct clock clock_old = {0, 0}; + + for (;;) { + long foo; + + if (foo == clock_old.sec && 0 == clock_old.usec); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000802-1.c b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c new file mode 100644 index 000000000..0b2f1d6af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c @@ -0,0 +1,15 @@ +struct foo { + char a[3]; + char b; + char c; +}; + +struct foo bs; +int x; +char y[3]; + +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/20000803-1.c b/gcc/testsuite/gcc.c-torture/compile/20000803-1.c new file mode 100644 index 000000000..08b50a9f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000803-1.c @@ -0,0 +1,11 @@ +static int gl_cnt = 0; +static char gl_buf[1024]; + +void +gl_yank() +{ + int i; + + for (i=gl_cnt; i >= 0; i--) + gl_buf[i+10] = gl_buf[i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000804-1.c b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c new file mode 100644 index 000000000..0a63a32df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c @@ -0,0 +1,20 @@ +/* This does not work on m68hc11 or h8300 due to the use of an asm + statement to force a 'long long' (64-bits) to go in a register. */ +/* { dg-do assemble } */ +/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */ +/* { dg-skip-if "No 64-bit registers" { m32c-*-* } { "*" } { "" } } */ +/* { dg-skip-if "Not enough 64-bit registers" { pdp11-*-* } { "-O0" } { "" } } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* h8300-*-* } { "*" } { "" } } */ + +/* Copyright (C) 2000, 2003 Free Software Foundation */ +__complex__ long long f () +{ + int i[99]; + __complex__ long long v; + + v += f (); + asm("": "+r" (v) : "r" (0), "r" (1)); + v = 2; + return v; + g (&v); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000818-1.c b/gcc/testsuite/gcc.c-torture/compile/20000818-1.c new file mode 100644 index 000000000..01f10f60c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000818-1.c @@ -0,0 +1,6 @@ +void +foo (long double x) +{ + struct {long double t;} y = {x}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000825-1.c b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c new file mode 100644 index 000000000..3c2e5bda7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c @@ -0,0 +1,31 @@ +typedef signed int s32; +typedef signed long s64; +typedef unsigned int u32; +typedef unsigned long u64; + +extern __inline__ u32 foobar(int logmask) +{ + u32 ret = ~(1 << logmask); // fails + // s32 ret = ~(1 << logmask); // ok + // u64 ret = ~(1 << logmask); // ok + // s64 ret = ~(1 << logmask); // ok + return ret; +} + +// This procedure compiles fine... +u32 good(u32 var) +{ + var = foobar(0); + return var; +} + +// This procedure does not compile... +// Same as above, but formal parameter is a pointer +// Both good() and fails() compile ok if we choose +// a different type for "ret" in foobar(). +u32 fails(u32 *var) +{ + *var = foobar(0); + return *var; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000827-1.c b/gcc/testsuite/gcc.c-torture/compile/20000827-1.c new file mode 100644 index 000000000..a985f908b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000827-1.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva <aoliva@redhat.com> */ + +int +foo () +{ + while (1) + { + int a; + char b; + /* gcse should not merge these asm statements, since their + output operands have different modes. */ + __asm__("":"=r" (a)); __asm__("":"=r" (b)); + if (b) + return a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000922-1.c b/gcc/testsuite/gcc.c-torture/compile/20000922-1.c new file mode 100644 index 000000000..0fef966e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000922-1.c @@ -0,0 +1,12 @@ +extern void doit(int); +void +quick_doit(int x) +{ +#ifdef __OPTIMIZE__ + if (__builtin_constant_p (x) + && x != 0) + asm volatile ("%0" : : "i#*X"(x)); + else +#endif + doit(x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000923-1.c b/gcc/testsuite/gcc.c-torture/compile/20000923-1.c new file mode 100644 index 000000000..9ed988682 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000923-1.c @@ -0,0 +1,8 @@ +const int a = 3; +const int b = 50; + +void foo (void) +{ + long int x[a][b]; + asm ("" : : "r" (x) : "memory"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001018-1.c b/gcc/testsuite/gcc.c-torture/compile/20001018-1.c new file mode 100644 index 000000000..86e5cd5dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001018-1.c @@ -0,0 +1,10 @@ +void +foo (void) +{ + extern char i[10]; + + { + extern char i[]; + char x[sizeof (i) == 10 ? 1 : -1]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001024-1.c b/gcc/testsuite/gcc.c-torture/compile/20001024-1.c new file mode 100644 index 000000000..59208cde1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001024-1.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Nathan Sidwell <nathan@codesourcery.com> */ + +typedef __SIZE_TYPE__ size_t; + +extern void *memset(void *, int, size_t); + +struct Baz; + +void quux(struct Baz *context) +{ + memset(context, 0, 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c new file mode 100644 index 000000000..6e513c956 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c @@ -0,0 +1,9 @@ +/* This does not work on NetWare, which has a default of 1-byte alignment. */ +/* { dg-xfail-if "" { "*-*-netware*" } { "*" } { "" } } */ +typedef struct _foo foo; +extern foo bar; +struct _foo { + int a; +}; + +int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c new file mode 100644 index 000000000..1448215c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c @@ -0,0 +1,8 @@ +/* This does not work on NetWare, which has a default of 1-byte alignment. */ +/* { dg-xfail-if "" { "*-*-netware*" } { "*" } { "" } } */ +extern struct foo bar; +struct foo { + int a; +}; + +int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20001116-1.c b/gcc/testsuite/gcc.c-torture/compile/20001116-1.c new file mode 100644 index 000000000..c356392fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001116-1.c @@ -0,0 +1,3 @@ +int x[60]; +char *y = ((char*)&(x[2*8 + 2]) - 8); +int z = (&"Foobar"[1] - &"Foobar"[0]); diff --git a/gcc/testsuite/gcc.c-torture/compile/20001121-1.c b/gcc/testsuite/gcc.c-torture/compile/20001121-1.c new file mode 100644 index 000000000..38efe6da0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001121-1.c @@ -0,0 +1,21 @@ +extern int bar(int); + +int foo(int x) +{ + return 1 + bar( + ({ + int y; + switch (x) + { + case 0: y = 1; break; + case 1: y = 2; break; + case 2: y = 3; break; + case 3: y = 4; break; + case 4: y = 5; break; + case 5: y = 6; break; + default: y = 7; break; + } + y; + }) + ); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001123-1.c b/gcc/testsuite/gcc.c-torture/compile/20001123-1.c new file mode 100644 index 000000000..59534480d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001123-1.c @@ -0,0 +1,11 @@ + +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; + +struct X { int y; }; + +void func(va_list va) +{ + char* a = __builtin_va_arg(va, char**)[0]; + int b = __builtin_va_arg(va, struct X*)->y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001123-2.c b/gcc/testsuite/gcc.c-torture/compile/20001123-2.c new file mode 100644 index 000000000..dcb5dd1fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001123-2.c @@ -0,0 +1,21 @@ +/* Copyright 2000 Free Software Foundation + + by Alexandre Oliva <aoliva@redhat.com> + + Based on zlib/gzio.c. + + This used to generate duplicate labels when compiled with + sh-elf-gcc -O2 -m3 -fPIC. + + Bug reported by NIIBE Yutaka <gniibe@m17n.org>. */ + +void foo (void); + +void +bar () +{ + unsigned len; + + for (len = 0; len < 2; len++) + foo (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001205-1.c b/gcc/testsuite/gcc.c-torture/compile/20001205-1.c new file mode 100644 index 000000000..bab7b69ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001205-1.c @@ -0,0 +1,26 @@ +/* This does not work on m68hc11 due to the asm statement which forces + two 'long' (32-bits) variables to go in registers. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "" } } */ + +static inline unsigned long rdfpcr(void) +{ + unsigned long tmp, ret; + __asm__ ("" : "=r"(tmp), "=r"(ret)); + return ret; +} + +static inline unsigned long +swcr_update_status(unsigned long swcr, unsigned long fpcr) +{ + swcr &= ~0x7e0000ul; + swcr |= (fpcr >> 3) & 0x7e0000ul; + return swcr; +} + +unsigned long osf_getsysinfo(unsigned long flags) +{ + unsigned long w; + w = swcr_update_status(flags, rdfpcr()); + return w; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001212-1.c b/gcc/testsuite/gcc.c-torture/compile/20001212-1.c new file mode 100644 index 000000000..009138c5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001212-1.c @@ -0,0 +1,10 @@ +typedef struct +{ + long double l; +} ld; + +ld a (ld x, ld y) +{ + ld b; + b.l = x.l + y.l; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001221-1.c b/gcc/testsuite/gcc.c-torture/compile/20001221-1.c new file mode 100644 index 000000000..66ae71411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001221-1.c @@ -0,0 +1,70 @@ +static void +foo () +{ + long maplength; + int type; + { + const long nibbles = 8; + char buf1[nibbles + 1]; + char buf2[nibbles + 1]; + char buf3[nibbles + 1]; + buf1[nibbles] = '\0'; + buf2[nibbles] = '\0'; + buf3[nibbles] = '\0'; + ((nibbles) <= 16 + ? (({ + void *__s = (buf1); + union + { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } + *__u = __s; + unsigned char __c = (unsigned char)('0'); + switch ((unsigned int) (nibbles)) + { + case 16: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 12: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 0: + break; + } + __s; + })) + : 0); + ((nibbles) <= 16 + ? (({ + void *__s = (buf2); + union + { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } + *__u = __s; + unsigned char __c = (unsigned char)('0'); + switch ((unsigned int) (nibbles)) + { + case 16: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 12: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 8: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 4: + __u->__ui = __c * 0x01010101; + case 0: + break; + } + __s; + })) + : 0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001222-1.c b/gcc/testsuite/gcc.c-torture/compile/20001222-1.c new file mode 100644 index 000000000..de97eeef7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001222-1.c @@ -0,0 +1,6 @@ +/* Testcase for PR c/1501. */ +double __complex__ +f (void) +{ + return ~(1.0 + 2.0i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c new file mode 100644 index 000000000..8c93baccd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c @@ -0,0 +1,37 @@ +/* This does not assemble on m68hc11 because the function is larger + than 64K. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */ +/* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "too much code for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ +/* { dg-xfail-if "jump beyond 128K not supported" { xtensa*-*-* } { "-O0" } { "" } } */ +/* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */ +/* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */ +/* { dg-timeout-factor 4.0 } */ + +/* This testcase exposed two branch shortening bugs on powerpc. */ + +#define C(a,b) \ + if (a > b) goto gt; \ + if (a < b) goto lt; + +#define C4(x,b) C((x)[0], b) C((x)[1],b) C((x)[2],b) C((x)[3],b) +#define C16(x,y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3]) + +#define C64(x,y) C16(x,y) C16(x+4,y) C16(x+8,y) C16(x+12,y) +#define C256(x,y) C64(x,y) C64(x,y+4) C64(x,y+8) C64(x,y+12) + +#define C1024(x,y) C256(x,y) C256(x+16,y) C256(x+32,y) C256(x+48,y) +#define C4096(x,y) C1024(x,y) C1024(x,y+16) C1024(x,y+32) C1024(x,y+48) + +unsigned foo(int x[64], int y[64]) +{ + C4096(x,y); + + return 0x01234567; + gt: + return 0x12345678; + lt: + return 0xF0123456; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/200031109-1.c b/gcc/testsuite/gcc.c-torture/compile/200031109-1.c new file mode 100644 index 000000000..d1d495bac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/200031109-1.c @@ -0,0 +1,11 @@ +/* For a short time on the tree-ssa branch this would warn that + value was not initialized as it was optimizing !(value = (m?1:2)) + to 0 and not setting value before. */ + +int t(int m) +{ + int value; + if (!(value = (m?1:2))) + value = 0; + return value; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010102-1.c b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c new file mode 100644 index 000000000..a409b5660 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c @@ -0,0 +1,101 @@ +/* This testcase derives from gnu obstack.c/obstack.h and failed with + -O3 -funroll-all-loops, or -O1 -frename-registers -funroll-loops on + sparc-sun-solaris2.7. + + Copyright (C) 2001 Free Software Foundation. */ + +# define PTR_INT_TYPE __PTRDIFF_TYPE__ + +struct _obstack_chunk +{ + char *limit; + struct _obstack_chunk *prev; + char contents[4]; +}; + +struct obstack +{ + long chunk_size; + struct _obstack_chunk *chunk; + char *object_base; + char *next_free; + char *chunk_limit; + PTR_INT_TYPE temp; + int alignment_mask; + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; + unsigned use_extra_arg:1; + unsigned maybe_empty_object:1; + unsigned alloc_failed:1; +}; + +extern void _obstack_newchunk (struct obstack *, int); + +struct fooalign {char x; double d;}; +#define DEFAULT_ALIGNMENT \ + ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0)) +union fooround {long x; double d;}; +#define DEFAULT_ROUNDING (sizeof (union fooround)) + +#ifndef COPYING_UNIT +#define COPYING_UNIT int +#endif + +#define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ + : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) + +#define CALL_FREEFUN(h, old_chunk) \ + do { \ + if ((h) -> use_extra_arg) \ + (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ + else \ + (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ + } while (0) + +void +_obstack_newchunk (h, length) + struct obstack *h; + int length; +{ + register struct _obstack_chunk *old_chunk = h->chunk; + register struct _obstack_chunk *new_chunk; + register long new_size; + register long obj_size = h->next_free - h->object_base; + register long i; + long already; + + new_size = (obj_size + length) + (obj_size >> 3) + 100; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + new_chunk = CALL_CHUNKFUN (h, new_size); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) + { + for (i = obj_size / sizeof (COPYING_UNIT) - 1; + i >= 0; i--) + ((COPYING_UNIT *)new_chunk->contents)[i] + = ((COPYING_UNIT *)h->object_base)[i]; + already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); + } + else + already = 0; + for (i = already; i < obj_size; i++) + new_chunk->contents[i] = h->object_base[i]; + + if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + { + new_chunk->prev = old_chunk->prev; + CALL_FREEFUN (h, old_chunk); + } + + h->object_base = new_chunk->contents; + h->next_free = h->object_base + obj_size; + h->maybe_empty_object = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010107-1.c b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c new file mode 100644 index 000000000..222def4d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c @@ -0,0 +1,6 @@ +unsigned long x[4]; + +void foo(void) +{ + ((void (*)())(x+2))(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010112-1.c b/gcc/testsuite/gcc.c-torture/compile/20010112-1.c new file mode 100644 index 000000000..69bbe169e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010112-1.c @@ -0,0 +1,14 @@ +/* Test that putting an initialized variable in a register works. */ + +#ifdef __i386__ +#define REGISTER asm ("eax") +#elif defined (__arm__) +#define REGISTER asm ("r0") +#else +/* Put examples for other architectures here. */ +#define REGISTER +#endif + +void f() { + register int i REGISTER = 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010113-1.c b/gcc/testsuite/gcc.c-torture/compile/20010113-1.c new file mode 100644 index 000000000..35b7c1f1d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010113-1.c @@ -0,0 +1,15 @@ +/* Origin: PR c/364 from and@genesyslab.com, very much reduced to a + testcase by Joseph Myers <jsm28@cam.ac.uk>. + + The initializer of z is a valid address constant, and GCC 2.95.2 + accepts it as such. CVS GCC as of 2001-01-13 rejects it, but accepts + it if y is changed to x in the initializer. */ + +struct { + struct { + int x; + int y; + } p; +} v; + +int *z = &((&(v.p))->y); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-1.c b/gcc/testsuite/gcc.c-torture/compile/20010114-1.c new file mode 100644 index 000000000..9b608aad1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010114-1.c @@ -0,0 +1,5 @@ +/* Origin: PR c/166 from Joerg Czeranski <jc@joerch.org>. */ +/* In the declaration of proc, x cannot be parsed as a typedef name, + so it must be parsed as a parameter name. */ +typedef int x; +void proc(int (*x)(void)) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-2.c b/gcc/testsuite/gcc.c-torture/compile/20010114-2.c new file mode 100644 index 000000000..75f5ea20e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010114-2.c @@ -0,0 +1,6 @@ +/* Origin: <URL:http://gcc.gnu.org/ml/gcc-patches/2000-12/msg01384.html> + from Fred Fish <fnf@geekgadgets.org>. See also PR c/1625. */ + +#include <stdbool.h> + +struct { int x; bool y; } foo = { 0, false }; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010117-1.c b/gcc/testsuite/gcc.c-torture/compile/20010117-1.c new file mode 100644 index 000000000..d0772b3c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010117-1.c @@ -0,0 +1,7 @@ +unsigned char u, v, w; + +void baz (void) +{ + if ((u - v - w) & 0x80) + v = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010117-2.c b/gcc/testsuite/gcc.c-torture/compile/20010117-2.c new file mode 100644 index 000000000..813468b56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010117-2.c @@ -0,0 +1,20 @@ +unsigned char a, b; + +void baz (void) +{ + if (b & 0x08) + { + int g = 0; + int c = (b & 0x01); + int d = a - g - c; + int e = (a & 0x0f) - (g & 0x0f); + int f = (a & 0xf0) - (g & 0xf0); + int h = (a & 0x0f) - (g & 0x0f); + + if ((a ^ g) & (a ^ d) & 0x80) b |= 0x40; + if ((d & 0xff00) == 0) b |= 0x01; + if (!((a - h - c) & 0xff)) b |= 0x02; + if ((a - g - c) & 0x80) b |= 0x80; + a = (e & 0x0f) | (f & 0xf0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010118-1.c b/gcc/testsuite/gcc.c-torture/compile/20010118-1.c new file mode 100644 index 000000000..6d1fc6431 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010118-1.c @@ -0,0 +1,21 @@ +static unsigned int bar(void *h, unsigned int n) +{ + static int i; + return i++; +} + +static void baz(unsigned int *x) +{ + (*x)++; +} + +long +foo(void *h, unsigned int l) +{ + unsigned int n; + long m; + n = bar(h, 0); + n = bar(h, n); + m = ({ baz(&n); 21; }); + return m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010124-1.c b/gcc/testsuite/gcc.c-torture/compile/20010124-1.c new file mode 100644 index 000000000..dd2d9c117 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010124-1.c @@ -0,0 +1,9 @@ +/* Origin: testcase from Joseph Myers <jsm28@cam.ac.uk>, problem pointed + out in a post to comp.std.c + <980283801.3063.0.nnrp-07.c2deb1c2@news.demon.co.uk> + by Dibyendu Majumdar <dibyendu@mazumdar.demon.co.uk>. + Compound literals should be parsed as postfix expressions, rather than + as cast expressions. In particular, they are valid operands of sizeof. */ + +struct s { int a; int b; }; +char x[((sizeof (struct s){ 1, 2 }) == sizeof (struct s)) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010202-1.c b/gcc/testsuite/gcc.c-torture/compile/20010202-1.c new file mode 100644 index 000000000..e72586a33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010202-1.c @@ -0,0 +1,6 @@ +int foo (int n, char m[1][n]); + +int foo (int n, char m[1][n]) +{ +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20010209-1.c b/gcc/testsuite/gcc.c-torture/compile/20010209-1.c new file mode 100644 index 000000000..20434644b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010209-1.c @@ -0,0 +1,7 @@ +short int a; + +int main (void) +{ + a = 65535.0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c new file mode 100644 index 000000000..f25b48390 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c @@ -0,0 +1,24 @@ +/* { dg-require-effective-target trampolines } */ + +void f1 (void *); +void f3 (void *, void (*)(void *)); +void f2 (void *); + +int foo (void *a, int b) +{ + if (!b) + { + f1 (a); + return 1; + } + if (b) + { + void bar (void *c) + { + if (c == a) + f2 (c); + } + f3 (a, bar); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010227-1.c b/gcc/testsuite/gcc.c-torture/compile/20010227-1.c new file mode 100644 index 000000000..767cb0d1c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010227-1.c @@ -0,0 +1,6 @@ +void foo (void) +{ + double a = 0.0; + double b = a; + if (&b != &a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010313-1.c b/gcc/testsuite/gcc.c-torture/compile/20010313-1.c new file mode 100644 index 000000000..a5a6ee652 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010313-1.c @@ -0,0 +1,5 @@ +/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ +/* After the open parenthesis before the __attribute__, we used to shift + the __attribute__ (expecting a parenthesised abstract declarator) + instead of reducing to the start of a parameter list. */ +void bar (int (__attribute__((__mode__(__SI__))) int foo)); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010320-1.c b/gcc/testsuite/gcc.c-torture/compile/20010320-1.c new file mode 100644 index 000000000..14686d623 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010320-1.c @@ -0,0 +1,28 @@ +typedef struct sec { +const char *name; +int id; +int index; +struct sec *next; +unsigned int flags; +unsigned int user_set_vma : 1; +unsigned int reloc_done : 1; +unsigned int linker_mark : 1; +unsigned int gc_mark : 1; +unsigned int segment_mark : 1; +unsigned long long vma; } asection; + +static void pe_print_pdata (asection *section) +{ + unsigned long long i; + unsigned long long start = 0, stop = 0; + int onaline = (3*8) ; + + for (i = start; i < stop; i += onaline) + { + if (i + (3*8) > stop) + break; + + f (((unsigned long) ((( i + section->vma ) >> 32) & 0xffffffff)) , ((unsigned long) ((( i + section->vma ) & 0xffffffff))) ) ; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20010326-1.c b/gcc/testsuite/gcc.c-torture/compile/20010326-1.c new file mode 100644 index 000000000..43acf4588 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010326-1.c @@ -0,0 +1,16 @@ +float d; +int e, f; + +void foo (void) +{ + struct { float u, v; } a = {0.0, 0.0}; + float b; + int c; + + c = e; + if (c == 0) + c = f; + b = d; + if (a.v < b) + a.v = b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c new file mode 100644 index 000000000..ce68f78df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c @@ -0,0 +1,15 @@ +/* { dg-skip-if "non-SI pointers" { m32c-*-* } { "*" } { "" } } */ +/* { dg-skip-if "HI mode pointer for avr" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "HI mode pointer for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "non-SI pointers for w64" { "x86_64-*-mingw*" } { "*" } { "" } } */ + +/* This testcase tests whether GCC can produce static initialized data + that references addresses of size 'unsigned long', even if that's not + the same as __SIZE_TYPE__. (See 20011114-1.c for the same test of + size __SIZE_TYPE__.) + + Some rare environments might not have the required relocs to support + this; they should have this test disabled in the .x file. */ + +extern void _text; +static unsigned long x = (unsigned long) &_text - 0x10000000L - 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010328-1.c b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c new file mode 100644 index 000000000..951ae78b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c @@ -0,0 +1,80 @@ +typedef __SIZE_TYPE__ size_t; +typedef unsigned int __u_int; +typedef unsigned long __u_long; + +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; + +typedef struct + { + int __val[2]; + } __fsid_t; + +typedef long int __blksize_t; +typedef long int __blkcnt_t; +typedef __quad_t __blkcnt64_t; +typedef __u_long __fsblkcnt_t; +typedef __u_quad_t __fsblkcnt64_t; +typedef __u_long __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; +typedef __u_quad_t __ino64_t; + +extern void *memcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) ; + +struct statfs + { + int f_type; + int f_bsize; + + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_bavail; + __fsfilcnt_t f_files; + __fsfilcnt_t f_ffree; + + __fsid_t f_fsid; + int f_namelen; + int f_spare[6]; + }; + + +struct statfs64 + { + int f_type; + int f_bsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsid_t f_fsid; + int f_namelen; + int f_spare[6]; + }; + +extern int __statfs (__const char *__file, struct statfs *__buf); +extern int __statfs64 (__const char *__file, struct statfs64 *__buf); + + +int +__statfs64 (const char *file, struct statfs64 *buf) +{ + struct statfs buf32; + + if (__statfs (file, &buf32) < 0) + return -1; + + buf->f_type = buf32.f_type; + buf->f_bsize = buf32.f_bsize; + buf->f_blocks = buf32.f_blocks; + buf->f_bfree = buf32.f_bfree; + buf->f_bavail = buf32.f_bavail; + buf->f_files = buf32.f_files; + buf->f_ffree = buf32.f_ffree; + buf->f_fsid = buf32.f_fsid; + buf->f_namelen = buf32.f_namelen; + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010329-1.c b/gcc/testsuite/gcc.c-torture/compile/20010329-1.c new file mode 100644 index 000000000..4d495e1af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010329-1.c @@ -0,0 +1,17 @@ +union u { + unsigned char a; + double b; +}; + +int a; + +union u foo (void) +{ + union u b; + + if (a) + b.a = 1; + else + b.a = 0; + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010404-1.c b/gcc/testsuite/gcc.c-torture/compile/20010404-1.c new file mode 100644 index 000000000..f890118e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010404-1.c @@ -0,0 +1,15 @@ +/* This testcase caused a floating point exception in the compiler when + compiled with -O2. The crash occurs when trying to simplify division + and modulo operations. */ + +#include <limits.h> + +extern void bar (int); + +void foo () +{ + int a = INT_MIN; + int b = -1; + bar (a / b); + bar (a % b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010408-1.c b/gcc/testsuite/gcc.c-torture/compile/20010408-1.c new file mode 100644 index 000000000..9aa3597a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010408-1.c @@ -0,0 +1,77 @@ +extern struct win *windows, *wtab[]; +struct win +{ + struct win *w_next; +}; + +struct auser; + +struct comm +{ + char *name; + int flags; +}; + +extern struct comm comms[]; + +extern int WindowByNoN (char *); +extern int FindCommnr (char *); +extern int AclSetPermCmd (struct auser *, char *, struct comm *); +extern int AclSetPermWin (struct auser *, struct auser *, char *, struct win *); + + +int + AclSetPerm(uu, u, mode, s) + struct auser *uu, *u; +char *mode, *s; +{ + struct win *w; + int i; + char *p, ch; + + do + { + } + while (0); + + while (*s) + { + switch (*s) + { + case '*': + return AclSetPerm(uu, u, mode, "#?"); + case '#': + if (uu) + AclSetPermWin(uu, u, mode, (struct win *)1); + else + for (w = windows; w; w = w->w_next) + AclSetPermWin((struct auser *)0, u, mode, w); + s++; + break; + case '?': + if (uu) + AclSetPermWin(uu, u, mode, (struct win *)0); + else + for (i = 0; i <= 174; i++) + AclSetPermCmd(u, mode, &comms[i]); + s++; + break; + default: + for (p = s; *p && *p != ' ' && *p != '\t' && *p != ','; p++) + ; + if ((ch = *p)) + *p++ = '\0'; + if ((i = FindCommnr(s)) != -1) + AclSetPermCmd(u, mode, &comms[i]); + else if (((i = WindowByNoN(s)) >= 0) && wtab[i]) + AclSetPermWin((struct auser *)0, u, mode, wtab[i]); + else + return -1; + if (ch) + p[-1] = ch; + s = p; + } + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010421-1.c b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c new file mode 100644 index 000000000..bec6aa903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c @@ -0,0 +1,8 @@ +int j; + +void residual () +{ + long double s; + for (j = 3; j < 9; j++) + s -= 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010423-1.c b/gcc/testsuite/gcc.c-torture/compile/20010423-1.c new file mode 100644 index 000000000..ef7771f8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010423-1.c @@ -0,0 +1,16 @@ +/* Origin: PR c/2618 from Cesar Eduardo Barros <cesarb@nitnet.com.br>, + adapted to a testcase by Joseph Myers <jsm28@cam.ac.uk>. + + Boolean conversions were causing infinite recursion between convert + and fold in certain cases. */ + +#include <stdbool.h> + +bool x; +unsigned char y; + +void +fn (void) +{ + x = y & 0x1 ? 1 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010426-1.c b/gcc/testsuite/gcc.c-torture/compile/20010426-1.c new file mode 100644 index 000000000..356818f9e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010426-1.c @@ -0,0 +1,19 @@ +struct { char *m; long n; } a[20]; +int b = 20, c; +void bar(void) __attribute__((__noreturn__)); + +int +foo(int x) +{ + int i; + + for (i = 0; i < x; i++) + { + a[0].m = "a"; a[0].n = 10; c=1; + a[c].m = "b"; a[c].n = 32; c++; + if (c >= b) bar (); + a[c].m = "c"; a[c].n = 80; c++; + if (c >= b) bar (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010503-1.c b/gcc/testsuite/gcc.c-torture/compile/20010503-1.c new file mode 100644 index 000000000..75005f456 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010503-1.c @@ -0,0 +1,17 @@ +void f1 (double); +void f2 (int); + +void +foo (int type, double xx) +{ + if (type) + f1 (xx); + else + f2 (type); +} + +void +bar (int type) +{ + foo (type, 1.0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010510-1.c b/gcc/testsuite/gcc.c-torture/compile/20010510-1.c new file mode 100644 index 000000000..23d44f864 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010510-1.c @@ -0,0 +1,3 @@ +typedef char *ident; +#ident "This is ident" +ident i; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-1.c b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c new file mode 100644 index 000000000..0a1b284b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c @@ -0,0 +1,205 @@ +/* This was cut down from reload1.c in May 2001, was observed to cause + a bootstrap failure for powerpc-apple-darwin1.3. + + Copyright (C) 2001 Free Software Foundation. */ + +enum insn_code +{ + CODE_FOR_extendqidi2 = 3, + CODE_FOR_nothing = 870 +}; + +struct rtx_def; + +enum machine_mode +{ + VOIDmode, + MAX_MACHINE_MODE +}; + +typedef unsigned long long HARD_REG_ELT_TYPE; +typedef HARD_REG_ELT_TYPE HARD_REG_SET[((77 + (8 * 8) - 1) / (8 * 8))]; + +enum rtx_code +{ + UNKNOWN, + NIL, + REG, + LAST_AND_UNUSED_RTX_CODE = 256 +}; + +typedef struct +{ + unsigned min_align:8; + unsigned base_after_vec:1; + unsigned min_after_vec:1; + unsigned max_after_vec:1; + unsigned min_after_base:1; + unsigned max_after_base:1; + unsigned offset_unsigned:1; + unsigned:2; + unsigned scale:8; +} +addr_diff_vec_flags; +typedef union rtunion_def +{ + long long rtwint; + int rtint; + unsigned int rtuint; + const char *rtstr; + struct rtx_def *rtx; + struct rtvec_def *rtvec; + enum machine_mode rttype; + addr_diff_vec_flags rt_addr_diff_vec_flags; + struct cselib_val_struct *rt_cselib; + struct bitmap_head_def *rtbit; + union tree_node *rttree; + struct basic_block_def *bb; +} +rtunion; +typedef struct rtx_def +{ + enum rtx_code code:16; + enum machine_mode mode:8; + unsigned int jump:1; + unsigned int call:1; + unsigned int unchanging:1; + unsigned int volatil:1; + unsigned int in_struct:1; + unsigned int used:1; + unsigned integrated:1; + unsigned frame_related:1; + rtunion fld[1]; +} + *rtx; + +enum reload_type +{ + RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN, + RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS, + RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, + RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR, + RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS +}; + +struct reload +{ + rtx in; + rtx out; + // enum reg_class class; + enum machine_mode inmode; + enum machine_mode outmode; + enum machine_mode mode; + unsigned int nregs; + int inc; + rtx in_reg; + rtx out_reg; + int regno; + rtx reg_rtx; + int opnum; + int secondary_in_reload; + int secondary_out_reload; + enum insn_code secondary_in_icode; + enum insn_code secondary_out_icode; + enum reload_type when_needed; + unsigned int optional:1; + unsigned int nocombine:1; + unsigned int secondary_p:1; + unsigned int nongroup:1; +}; + +struct insn_chain +{ + rtx insn; +}; + +extern int n_reloads; +static short reload_order[(2 * 10 * (2 + 1))]; +int reload_spill_index[(2 * 10 * (2 + 1))]; +extern struct reload rld[(2 * 10 * (2 + 1))]; +static rtx *reg_last_reload_reg; +static HARD_REG_SET reg_reloaded_valid; +static HARD_REG_SET reg_reloaded_dead; +static HARD_REG_SET reg_reloaded_died; +static HARD_REG_SET reg_is_output_reload; +extern const unsigned int mode_size[]; +extern int target_flags; + +static void +emit_reload_insns (chain) + struct insn_chain *chain; +{ + rtx insn = chain->insn; + register int j; + rtx following_insn = (((insn)->fld[2]).rtx); + rtx before_insn = (((insn)->fld[1]).rtx); + + for (j = 0; j < n_reloads; j++) + { + register int r = reload_order[j]; + register int i = reload_spill_index[r]; + + { + rtx out = (((enum rtx_code) (rld[r].out)->code) == REG ? rld[r].out : rld[r].out_reg); + register int nregno = (((out)->fld[0]).rtuint); + + if (nregno >= 77) + { + rtx src_reg, store_insn = (rtx) 0; + + reg_last_reload_reg[nregno] = 0; + if (src_reg && ((enum rtx_code) (src_reg)->code) == REG && (((src_reg)->fld[0]).rtuint) < 77) + { + int src_regno = (((src_reg)->fld[0]).rtuint); + int nr = + (((src_regno) >= 32 + && (src_regno) <= + 63) ? (((mode_size[(int) (rld[r].mode)]) + 8 - + 1) / 8) : (((mode_size[(int) (rld[r].mode)]) + + (!(target_flags & 0x00000020) ? 4 : + 8) - 1) / (!(target_flags & 0x00000020) ? 4 : 8))); + rtx note = 0; + + while (nr-- > 0) + { + ((reg_reloaded_dead) + [(src_regno + nr) / ((unsigned) (8 * 8))] &= + ~(((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8))))); + ((reg_reloaded_valid) + [(src_regno + nr) / ((unsigned) (8 * 8))] |= + ((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8)))); + ((reg_is_output_reload) + [(src_regno + nr) / ((unsigned) (8 * 8))] |= + ((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8)))); + if (note) + ((reg_reloaded_died) + [(src_regno) / ((unsigned) (8 * 8))] |= + ((HARD_REG_ELT_TYPE) (1)) << ((src_regno) % ((unsigned) (8 * 8)))); + else + ((reg_reloaded_died) + [(src_regno) / ((unsigned) (8 * 8))] &= + ~(((HARD_REG_ELT_TYPE) (1)) << ((src_regno) % ((unsigned) (8 * 8))))); + } + reg_last_reload_reg[nregno] = src_reg; + } + } + else + { + int num_regs = + (((nregno) >= 32 + && (nregno) <= + 63) + ? (((mode_size + [(int) (((enum machine_mode) (rld[r].out)->mode))]) + + 8 - + 1) / + 8) + : (((mode_size + [(int) (((enum machine_mode) (rld[r].out)->mode))]) + + (!(target_flags & 0x00000020) ? 4 : 8) - 1) / (!(target_flags & 0x00000020) ? 4 : 8))); + while (num_regs-- > 0) + reg_last_reload_reg[nregno + num_regs] = 0; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-2.c b/gcc/testsuite/gcc.c-torture/compile/20010518-2.c new file mode 100644 index 000000000..f35d7c6b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010518-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +/* This test fails on HC11/HC12 when it is compiled without -mshort because + the array is too large (INT_MAX/2 > 64K). Force to use 16-bit ints + for it. */ +/* { dg-options "-w -mshort" { target m6811-*-* m6812-*-* } } */ + +/* Large static storage. */ + +#include <limits.h> + +static volatile char chars_1[INT_MAX / 2]; +static volatile char chars_2[1]; + +int +foo (void) +{ + chars_1[10] = 'y'; + chars_2[0] = 'x'; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010525-1.c b/gcc/testsuite/gcc.c-torture/compile/20010525-1.c new file mode 100644 index 000000000..2e4ae382a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010525-1.c @@ -0,0 +1,6 @@ +static int kind_varread(char *str) +{ + if (0 == memcmp("%_#", str, 3)) return 2; + /* NOTREACHED */ +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-1.c b/gcc/testsuite/gcc.c-torture/compile/20010605-1.c new file mode 100644 index 000000000..036b79698 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010605-1.c @@ -0,0 +1,15 @@ +int +main (int argc, char **argv) +{ + int size = 10; + + typedef struct { + char val[size]; + } block; + block retframe_block() + { + return *(block*)0; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-2.c b/gcc/testsuite/gcc.c-torture/compile/20010605-2.c new file mode 100644 index 000000000..b8d9d5892 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010605-2.c @@ -0,0 +1,17 @@ +/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ +/* As an extension, GCC allows a struct or union to be cast to its own + type, but failed to allow this when a typedef was involved. + Reported as PR c/2735 by <cowan@ccil.org>. */ +union u { int i; }; +typedef union u uu; +union u a; +uu b; + +void +foo (void) +{ + a = (union u) b; + a = (uu) b; + b = (union u) a; + b = (uu) a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-3.c b/gcc/testsuite/gcc.c-torture/compile/20010605-3.c new file mode 100644 index 000000000..a43c0b1e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010605-3.c @@ -0,0 +1,20 @@ +struct A { unsigned long buf[100]; }; +int foo(unsigned int *x) +{ + unsigned int a; + + if (!x) + return -22; + +#ifdef __ia64__ + if (({ + register long b asm ("r8") = 0; + register long c asm ("r9") = 0; + asm ("" : "=r"(c), "=r"(b) : "m"(*(struct A *)x), "1"(b)); + a = (unsigned int) c; + b; })) + return -14; +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010610-1.c b/gcc/testsuite/gcc.c-torture/compile/20010610-1.c new file mode 100644 index 000000000..ee8e2431b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010610-1.c @@ -0,0 +1,19 @@ +/* Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + Boolean types were not accepted as array sizes nor as switch + quantities. */ + +#include <stdbool.h> + +int +main(void) +{ + bool arr[(bool)1]; + + switch (arr[0]) + { + default:; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010611-1.c b/gcc/testsuite/gcc.c-torture/compile/20010611-1.c new file mode 100644 index 000000000..87723bd49 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010611-1.c @@ -0,0 +1,24 @@ +/* Origin: PR c/3116 from Andreas Jaeger <aj@suse.de>. */ +/* When determining type compatibility of function types, we must remove + qualifiers from argument types. We used to fail to do this properly + in store_parm_decls when comparing prototype and non-prototype + declarations. */ +struct _IO_FILE { + int _flags; +}; + +typedef struct _IO_FILE __FILE; +typedef struct _IO_FILE _IO_FILE; +typedef long int wchar_t; + +extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, + __FILE *__restrict __stream); + +wchar_t * +fgetws (buf, n, fp) + wchar_t *buf; + int n; + _IO_FILE *fp; +{ + return (wchar_t *)0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010701-1.c b/gcc/testsuite/gcc.c-torture/compile/20010701-1.c new file mode 100644 index 000000000..7fb7ab5b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010701-1.c @@ -0,0 +1,5 @@ +/* Test that postfix attributes only apply to a single declared object. + (decl_attributes used to chain them onto the end of the prefix attributes, + which caused them to apply to other declarations as well.) */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ +void __attribute__((__noreturn__)) foo (const char *, ...) __attribute__((__format__(__printf__, 1, 2))), bar (void); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010706-1.c b/gcc/testsuite/gcc.c-torture/compile/20010706-1.c new file mode 100644 index 000000000..44aec371a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010706-1.c @@ -0,0 +1,5 @@ + +foo(unsigned int x) +{ + return (x << 1) | (x >> 31); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010711-1.c b/gcc/testsuite/gcc.c-torture/compile/20010711-1.c new file mode 100644 index 000000000..a0787421f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010711-1.c @@ -0,0 +1,11 @@ +typedef unsigned long long value; + +void foo (value *v) {} + +void test () +{ + value v; + foo (&v); + if (v-- > 0) + foo (&v); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010711-2.c b/gcc/testsuite/gcc.c-torture/compile/20010711-2.c new file mode 100644 index 000000000..2f8d68ba4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010711-2.c @@ -0,0 +1,11 @@ +typedef unsigned long long value; + +void foo (value *v) {} + +void test () +{ + value v; + foo (&v); + if (v-- == 1) + foo (&v); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010714-1.c b/gcc/testsuite/gcc.c-torture/compile/20010714-1.c new file mode 100644 index 000000000..fc4bdbac7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010714-1.c @@ -0,0 +1,5 @@ +/* Test that prefix attributes after a comma only apply to a single + declared object or function. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ + +__attribute__((noreturn)) void d0 (void), __attribute__((format(printf, 1, 2))) d1 (const char *, ...), d2 (void); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010824-1.c b/gcc/testsuite/gcc.c-torture/compile/20010824-1.c new file mode 100644 index 000000000..8e67722b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010824-1.c @@ -0,0 +1,7 @@ +void f(int n) +{ +bugcauser: + if (n != 0) + f(n-1); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-1.c b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c new file mode 100644 index 000000000..8e519f26e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c @@ -0,0 +1,28 @@ +struct A { + long a; +}; + +static inline void foo(struct A *x) +{ + __asm__ __volatile__("" : "+m"(x->a) : "r"(x) : "memory", "cc"); +} + +static inline void bar(struct A *x) +{ + foo(x); +} + +struct B { char buf[640]; struct A a; }; +struct B b[32]; + +int baz(void) +{ + int i; + struct B *j; + for (i = 1; i < 32; i++) + { + j = &b[i]; + bar(&j->a); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-2.c b/gcc/testsuite/gcc.c-torture/compile/20010903-2.c new file mode 100644 index 000000000..a5d78c011 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010903-2.c @@ -0,0 +1,15 @@ +extern int __dummy (void *__preg, const char *__string); +extern int rpmatch (const char *response); + +int +rpmatch (const char *response) +{ + auto inline int try (void *re); + + inline int try (void *re) + { + return __dummy (re, response); + } + static void *yesre; + return (try (&yesre)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010911-1.c b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c new file mode 100644 index 000000000..f5a4724bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c @@ -0,0 +1,4 @@ +/* Test for segfault handling an empty attribute. */ +/* Origin: PR c/4294 from <tori@ringstrom.mine.nu>. */ + +void __attribute__(()) foo(); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011010-1.c b/gcc/testsuite/gcc.c-torture/compile/20011010-1.c new file mode 100644 index 000000000..b01375543 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011010-1.c @@ -0,0 +1,10 @@ +extern int used (void); + + +int foo () +{ + int i; + for (; used (); ({while (1) if (used ()) return 0;})) + i++; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011023-1.c b/gcc/testsuite/gcc.c-torture/compile/20011023-1.c new file mode 100644 index 000000000..eca1adf17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011023-1.c @@ -0,0 +1,14 @@ +/* Test whether tree inlining works with prototyped nested functions. */ + +extern void foo (char *x); +void bar (void); +void bar (void) +{ + auto void baz (void); + void baz (void) + { + char tmp[2]; + foo (tmp); + } + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011029-1.c b/gcc/testsuite/gcc.c-torture/compile/20011029-1.c new file mode 100644 index 000000000..3b2bcdf2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011029-1.c @@ -0,0 +1,9 @@ +void foo (void *) __attribute__ ((noreturn)); + +void +bar (void *x) +{ + if (__builtin_setjmp (x)) + return; + foo (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011106-1.c b/gcc/testsuite/gcc.c-torture/compile/20011106-1.c new file mode 100644 index 000000000..9363780a6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011106-1.c @@ -0,0 +1,7 @@ +/* Test that functions passed to the comma operator are correctly converted + to pointers. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ + +void foo (void); +void (*fp) (void); +char x[sizeof (1, foo) == sizeof (fp) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011106-2.c b/gcc/testsuite/gcc.c-torture/compile/20011106-2.c new file mode 100644 index 000000000..358f9d2ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011106-2.c @@ -0,0 +1,7 @@ +/* Test the the type of a component of a conditional expression between + two structures is correct. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */ + +struct s { char c; } a, b; +int c; +char x[sizeof ((c ? a : b).c) == 1 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011109-1.c b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c new file mode 100644 index 000000000..f1987a74b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c @@ -0,0 +1,51 @@ +typedef struct { short x[4]; } S; +typedef struct { unsigned int a, b, c; S *d; } T; + +S *(*foo) (T *, int, int, int, int); +unsigned short *(*bar)(const T *); +unsigned short baz(T *,const int); + +T *die (void) +{ + typedef struct { unsigned int a, b, e; double f, g; } U; + + char h[8], i[2053], j[2053]; + double k, l, m; + U n; + T *o; + unsigned short p; + int q, r; + long s; + unsigned short *t; + S *u; + unsigned char *v, *w; + unsigned int x; + + o = 0; + for (x = 0; x < n.e; x++) + { + l = 1.0; + if (n.g - n.f <= 1.0) + l = ((1 << o->c) - 1) / (n.g - n.f); + v = w; + for (r = o->b - 1; r >= 0; r--) + { + u = foo (o, 0, r, o->a, 1); + if (!u) + break; + t = bar (o); + for (q = 0; q < (int) o->a; q++) + { + h[0] = *v; + s = *v++; + k = (double) s; + m = l*k; + p = m < 0 ? 0 : m > (1 << o->c) - 1 ? (1 << o->c) - 1 : m + 0.5; + p = baz (o,p); + t[q] = p; + *u++ = o->d[p]; + } + } + } + return o; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-1.c b/gcc/testsuite/gcc.c-torture/compile/20011114-1.c new file mode 100644 index 000000000..5e6e82184 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-1.c @@ -0,0 +1,2 @@ +extern void _text; +static __SIZE_TYPE__ x = (__SIZE_TYPE__) &_text - 0x10000000L - 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-2.c b/gcc/testsuite/gcc.c-torture/compile/20011114-2.c new file mode 100644 index 000000000..46f0aedeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-2.c @@ -0,0 +1,13 @@ +typedef struct { int c, d, e, f, g; } D; + +void bar (unsigned long, unsigned long); +void foo (D *y) +{ + int x = 0; + + if (y->f == 0) + x |= 0x1; + if (y->g == 0) + x |= 0x2; + bar ((x << 16) | (y->c & 0xffff), (y->d << 16) | (y->e & 0xffff)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-3.c b/gcc/testsuite/gcc.c-torture/compile/20011114-3.c new file mode 100644 index 000000000..882792525 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-3.c @@ -0,0 +1,42 @@ +typedef struct { int s, t; } C; +C x; +int foo (void); +void bar (int); + +int baz (void) +{ + int a = 0, c, d = 0; + C *b = &x; + + while ((c = foo ())) + switch(c) + { + case 23: + bar (1); + break; + default: + break; + } + + if (a == 0 || (a & 1)) + { + if (b->s) + { + if (a) + bar (1); + else + a = 16; + } + else if (b->t) + { + if (a) + bar (1); + else + a = 32; + } + } + + if (d && (a & ~127)) + bar (2); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-4.c b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c new file mode 100644 index 000000000..516ef4f23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c @@ -0,0 +1,38 @@ +static inline int foo (long x) +{ + register int a = 0; + register unsigned b; + + do + { + b = (x & 0x7f); + x = (x >> 7) | ~(-1L >> 7); + a += 1; + } + while ((x != 0 || (b & 0x40) != 0) && (x != -1 || (b & 0x40) == 0)); + return a; +} + +static inline int bar (unsigned long x) +{ + register int a = 0; + register unsigned b; + + do + { + b = (x & 0x7f); + x >>= 7; + a++; + } + while (x != 0); + return a; +} + +int +baz (unsigned long x, int y) +{ + if (y) + return foo ((long) x); + else + return bar (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c new file mode 100644 index 000000000..b4b80ae2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c @@ -0,0 +1,10 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +extern inline int foo (void) { return 23; } +int xxx(void) __asm__(ASMNAME ("xxx")); +int xxx(void) { return 23; } +extern int foo (void) __attribute__ ((weak, alias ("xxx"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c new file mode 100644 index 000000000..e06809f33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c @@ -0,0 +1,12 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +extern inline int foo (void) { return 23; } +int bar (void) { return foo (); } +extern int foo (void) __attribute__ ((weak, alias ("xxx"))); +int baz (void) { return foo (); } +int xxx(void) __asm__(ASMNAME ("xxx")); +int xxx(void) { return 23; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20011130-1.c b/gcc/testsuite/gcc.c-torture/compile/20011130-1.c new file mode 100644 index 000000000..55d4af482 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011130-1.c @@ -0,0 +1,7 @@ +struct S { int i; }; +extern struct S x[]; +char *bar (const struct S *); +void foo (void) +{ + bar (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011130-2.c b/gcc/testsuite/gcc.c-torture/compile/20011130-2.c new file mode 100644 index 000000000..e3cb5f46a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011130-2.c @@ -0,0 +1,54 @@ +/* This testcase caused infinite loop in life info computation + after if conversion on IA-64. Conditional register dead for + pseudo holding sign-extended k was improperly computed, + resulting in this pseudo being live at start of bb if it was + dead at the end and vice versa; as it was a bb which had edge + to itself, this resulted in alternative propagating this basic + block forever. */ + +typedef struct { + unsigned char a; + unsigned char b; +} S0; + +typedef struct { + S0 *c; + int d; + unsigned int e; + unsigned char *f[3]; + void *g; +} S1; + +int bar (int, void *); + +int foo (S1 *x, float y) +{ + S0 *h; + int i, j, k, l, m; + float n, o, p; + unsigned char *q, *r[3]; + + h = x->c; + m = h->a; + l = h->b; + n = y; + o = 0.0; + if (x->d == 8) + for (j = 0; j < x->e; j++) + for (k = 0; k < 3; k++) + { + n = y; + o = 0.0; + if (m) + q = x->f[k] + x->e - 1 - j; + else + q = x->f[k] + j; + p = (*q - o) * y / (n - o); + p = 0.0 > p ? 0.0 : p; + p = y < p ? y : p; + if (l) + p = r[k][(int) p]; + bar (p, x->g); + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011205-1.c b/gcc/testsuite/gcc.c-torture/compile/20011205-1.c new file mode 100644 index 000000000..ffc5ac419 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011205-1.c @@ -0,0 +1,10 @@ +/* Failure to mark_addressable all operands before evaluation means we + don't set up the proper temporaries, which leaves us with an asm that + doesn't match its contraints. */ + +long foo() +{ + long x; + asm("" : "=r"(x) : "m"(x)); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011217-1.c b/gcc/testsuite/gcc.c-torture/compile/20011217-1.c new file mode 100644 index 000000000..3e89ca04c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011217-1.c @@ -0,0 +1,20 @@ +/* Test that the initializer of a compound literal is properly walked + when tree inlining. */ +/* Origin: PR c/5105 from <aj@suse.de>. */ + +typedef struct { long p; } pt; + +inline pt f (pt _p) +{ + long p = _p.p; + + return (pt) { (p) }; +} + +static int mmap_mem (void) +{ + pt p; + p = f (p); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011217-2.c b/gcc/testsuite/gcc.c-torture/compile/20011217-2.c new file mode 100644 index 000000000..0d9935969 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011217-2.c @@ -0,0 +1,19 @@ +/* Test that the initializer of a compound literal is properly walked + when tree inlining. */ +/* Origin: glibc (as reported in PR c/5105) from <aj@suse.de>. */ + +inline int +finite (double __x) +{ + return (__extension__ + (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1] + | 0x800fffffu) + 1) >> 31)); +} + +int +main (void) +{ + double x = 1.0; + + return finite (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011218-1.c b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c new file mode 100644 index 000000000..bf63489b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c @@ -0,0 +1,16 @@ +/* This testcase failed on Alpha at -O2 because $27 hard register + for the indirect call was exposed too early and reload couldn't + allocate it for multiplication and division. */ + +struct S { + int a, b; + void (*f) (long, int); +}; + +void foo (struct S *x) +{ + long c = x->a * 50; + c /= (long) x->b; + c *= (long) x->b; + x->f (c, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011219-1.c b/gcc/testsuite/gcc.c-torture/compile/20011219-1.c new file mode 100644 index 000000000..04923092d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011219-1.c @@ -0,0 +1,29 @@ +/* This testcase failed on IA-64 at -O2 during scheduling. */ + +void * baz (unsigned long); +static inline double ** +bar (long w, long x, long y, long z) +{ + long i, a = x - w + 1, b = z - y + 1; + double **m = (double **) baz (sizeof (double *) * (a + 1)); + + m += 1; + m -= w; + m[w] = (double *) baz (sizeof (double) * (a * b + 1)); + m[w] += 1; + m[w] -= y; + for (i = w + 1; i <= x; i++) + m[i] = m[i - 1] + b; + return m; +} + +void +foo (double w[], int x, double y[], double z[]) +{ + int i; + double **a; + + a = bar (1, 50, 1, 50); + for (i = 1; i <= x; i++) + a[1][i] = - w[x - i] / w[x]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011219-2.c b/gcc/testsuite/gcc.c-torture/compile/20011219-2.c new file mode 100644 index 000000000..2ad7eb1a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011219-2.c @@ -0,0 +1,20 @@ +/* This testcase failed on Alpha at -O2 when simplifying conditional + expressions. */ + +struct S { + unsigned long a; + double b, c; +}; + +extern double bar (double, double); + +int +foo (unsigned long x, unsigned int y, struct S *z) +{ + unsigned int a = z->a; + int b = y / z->a > 1 ? y / z->a : 1; + + a = y / b < z->a ? y / b : z->a; + z->c = z->b * bar ((double) a, (double) x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-1.c b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c new file mode 100644 index 000000000..97b265543 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c @@ -0,0 +1,78 @@ +/* ICE: call insn does not satisfy its constraints, MMIX port. + Origin: ghostscript-6.52, reduction from hp@bitrange.com. */ +struct s0 +{ + void (*init_color)(void *, void *); +}; +struct s1 +{ + void (*map_cmyk)(short, void *, void **, void *); + void (*map_rgb_alpha)(short, void *, void **, void *); +}; +struct s5 +{ + long fill1; int fill2; + long fill3; unsigned int fill4, fill5; +}; +struct s2 +{ + struct s5 x, y; +}; +struct s3 +{ + long dev_color; + unsigned int key; +}; +struct s4 +{ + unsigned char spp; + int alpha; + struct mc_ + { + unsigned int values[14]; + unsigned int mask, test; + int exact; + } mask_color; + void **pis; + struct s0 *pcs; + struct dd_ + { + struct s2 row[2]; + struct s2 pixel0; + } dda; + struct s3 clues[256]; +}; +extern struct s1 *get_cmap_procs (void **, void *); +int image_render_color (struct s4 *, unsigned char *, int, void *); +int +image_render_color (struct s4 *penum, unsigned char *buffer, + int data_x, void *dev) +{ + struct s3 *clues = penum->clues; + void **pis = penum->pis; + struct s2 pnext; + struct s0 *pcs = penum->pcs; + struct s1 *cmap_procs = get_cmap_procs(pis, dev); + void (*map_4)(short, void *, void **, void *) = + (penum->alpha ? cmap_procs->map_rgb_alpha : cmap_procs->map_cmyk); + unsigned int mask = penum->mask_color.mask; + unsigned int test = penum->mask_color.test; + struct s3 *pic_next = &clues[1]; + int spp = penum->spp; + unsigned char *psrc = buffer + data_x * spp; + unsigned char v[6]; + + pnext = penum->dda.pixel0; + __builtin_memset (&v, 0, sizeof(v)); + (*(pcs)->init_color) (0, 0); + + if (spp == 4) + { + v[0] = psrc[0]; + v[1] = psrc[1]; + if ((buffer[0] & mask) == test && penum->mask_color.exact) + pic_next->dev_color = 0; + (*map_4)(v[0], &pic_next->dev_color, pis, dev); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-2.c b/gcc/testsuite/gcc.c-torture/compile/20011229-2.c new file mode 100644 index 000000000..bb49bd18e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011229-2.c @@ -0,0 +1,17 @@ +/* Test whether jump threading doesn't ICE if redirecting the jump to exit + block. */ + +extern int bar (); +extern void baz (); + +void foo () +{ + int x; + + do + { + if ((x = bar ()) == 1) + baz (); + } + while (x == 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020103-1.c b/gcc/testsuite/gcc.c-torture/compile/20020103-1.c new file mode 100644 index 000000000..b9861688d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020103-1.c @@ -0,0 +1,22 @@ +/* This testcase failed on Alpha at -O2 when simplifying conditional + expressions. */ + +int foo (void); + +struct A +{ + int a, b, c, d; +}; + +void bar (struct A *x) +{ + int e, f; + + e = foo (); + e = e / x->b; + if (e < 1) + e = 1; + f = (x->a + x->c) / e; + if (f < x->d) + x->d -= (1 << 16) / 8; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020106-1.c b/gcc/testsuite/gcc.c-torture/compile/20020106-1.c new file mode 100644 index 000000000..c114af1aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020106-1.c @@ -0,0 +1,8 @@ +/* Origin: PR c/5279 from <wilco@equator.com>. */ + +int +foo () +{ + extern long long Y; + return (0 > Y++); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020109-1.c b/gcc/testsuite/gcc.c-torture/compile/20020109-1.c new file mode 100644 index 000000000..532fe6de2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020109-1.c @@ -0,0 +1,23 @@ +/* This testcase ICEd when 2 different successors of a basic block + were successfully threaded and try_forward_edges was not expecting + that. */ + +typedef struct A +{ + struct A *s, *t; + unsigned int u; +} A; + +void bar (A *); + +void +foo (A *x, A *y, A *z) +{ + while (y + && (((y && y->t && y->t->u) ? y : z)->t + == ((x && x->t && x->t->u) ? x : z)->t)) + y = y->s; + + if (y) + bar (y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020109-2.c b/gcc/testsuite/gcc.c-torture/compile/20020109-2.c new file mode 100644 index 000000000..316731565 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020109-2.c @@ -0,0 +1,30 @@ +typedef union +{ + unsigned char member3; + signed short member4; + unsigned int member5; +} +UNI02; + +struct srt_dat_t +{ + UNI02 un2; + unsigned long member1; + signed short member2; +}; + +struct srt_dat_t exsrt1; +void +extern_test (struct srt_dat_t arg1) +{ + arg1.un2.member3++; + arg1.member1++; + arg1.member2++; +} + +int +main (void) +{ + extern_test (exsrt1); + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020110.c b/gcc/testsuite/gcc.c-torture/compile/20020110.c new file mode 100644 index 000000000..90e0ce95d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020110.c @@ -0,0 +1,12 @@ +/* Copyright 2002 Free Software Foundation */ + +/* Make sure the nested extern declaration doesn't conflict with the + non-extern one in the enclosing scope. */ + +void foo() { + static long bar; + + { + extern int bar; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020116-1.c b/gcc/testsuite/gcc.c-torture/compile/20020116-1.c new file mode 100644 index 000000000..6c023edca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020116-1.c @@ -0,0 +1,28 @@ +void noret (void) __attribute__ ((noreturn)); +int foo (int, char **); +char *a, *b; +int d; + +int +main (int argc, char **argv) +{ + register int c; + + d = 1; + while ((c = foo (argc, argv)) != -1) + switch (c) { + case 's': + case 'c': + case 'f': + a = b; + break; + case 'v': + d = 1; + break; + case 'V': + d = 0; + break; + } + noret (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020120-1.c b/gcc/testsuite/gcc.c-torture/compile/20020120-1.c new file mode 100644 index 000000000..e049a9720 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020120-1.c @@ -0,0 +1,55 @@ +/* This ICEed on IA-32 with -O2 -mcpu=i386, because reload was trying + to reload into %sil register. */ + +struct A +{ + void *a; + unsigned int b, c, d; +}; + +struct B +{ + struct A *e; +}; + +void bar (struct A *); +void baz (struct A *); + +static inline unsigned int +inl (unsigned int v, unsigned char w, unsigned char x, unsigned char y, + unsigned char z) +{ + switch (v) + { + case 2: + return ((w & 0xf8) << 8) | ((x & 0xfc) << 3) | ((y & 0xf8) >> 3); + case 4: + return (z << 24) | (w << 16) | (x << 8) | y; + default: + return 0; + } +} + +void foo (struct B *x, int y, const float *z) +{ + struct A *a = x->e; + + if (y) + { + if (x->e->a) + bar (x->e); + } + else + { + unsigned char c[4]; + unsigned int b; + + c[0] = z[0]; c[1] = z[1]; c[2] = z[2]; c[3] = z[3]; + b = inl (a->b, c[0], c[1], c[2], c[3] ); + if (a->a) + bar (a); + else + baz (a); + a->c = b; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020121-1.c b/gcc/testsuite/gcc.c-torture/compile/20020121-1.c new file mode 100644 index 000000000..f8950f4ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020121-1.c @@ -0,0 +1,30 @@ +/* This testcase resulted in a 'unrecognizeable insn' on powerpc-linux-gnu + because of a missing trunc_int_for_mode in simplify_and_const_int. */ + +struct display { + struct disphist *hstent; + int pid; + int status; +}; + +struct disphist { + struct disphist *next; + char *name; + int startTries; + unsigned rLogin:2, + sd_how:2, + sd_when:2, + lock:1, + goodExit:1; + char *nuser, *npass, **nargs; +}; + +void +StartDisplay (struct display *d) +{ + d->pid = 0; + d->status = 0; + d->hstent->lock = d->hstent->rLogin = d->hstent->goodExit = + d->hstent->sd_how = d->hstent->sd_when = 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c new file mode 100644 index 000000000..7b17ba475 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c @@ -0,0 +1,17 @@ +/* Test call to static variable. */ + +typedef struct +{ + long long a[10]; +} A; + +void bar (A *); + +typedef int (*B)(int); + +void foo (void) +{ + static A a; + bar (&a); + (*(B)&a) (1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020206-1.c b/gcc/testsuite/gcc.c-torture/compile/20020206-1.c new file mode 100644 index 000000000..c21c56454 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020206-1.c @@ -0,0 +1,18 @@ +/* Origin: PR optimization/5429 from Philipp Thomas <pthomas@suse.de>. */ +/* This testcase caused ICE on IA-32 -O2 -march=i686 due to rtl sharing + problem in noce_process_if_block. Fixed by + http://gcc.gnu.org/ml/gcc-patches/2002-01/msg02146.html. */ + +typedef struct { + unsigned char a; +} A; + +unsigned int foo (A *x) +{ + unsigned char b[2] = { 0, 0 }; + unsigned char c = 0; + + c = (x->a) ? b[1] : b[0]; + + return (unsigned int) c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020210-1.c b/gcc/testsuite/gcc.c-torture/compile/20020210-1.c new file mode 100644 index 000000000..5ca27f4f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020210-1.c @@ -0,0 +1,2 @@ +/* PR c/5615 */ +void f(int a, struct {int b[a];} c) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020303-1.c b/gcc/testsuite/gcc.c-torture/compile/20020303-1.c new file mode 100644 index 000000000..a120adf71 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020303-1.c @@ -0,0 +1,5 @@ +/* With -fzero-initialized-in-bss, we made I a common symbol instead + of a symbol in the .bss section. Not only does that break semantics, + but a common symbol can't be weak. */ + +int i __attribute__((weak)) = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-1.c b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c new file mode 100644 index 000000000..3940d5ffd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c @@ -0,0 +1,777 @@ +/* In 3.0, this test case (extracted from Bigloo) crashes the compiler in + bb-reorder.c. This is a regression from 2.95, already fixed in 3.1. + + Original bug report is c/5830 by Manuel Serrano <Manuel.Serrano@inria.fr>. + */ + +typedef union scmobj { + struct pair { + union scmobj *car; + union scmobj *cdr; + } pair_t; + struct vector { + long header; + int length; + union scmobj *obj0; + } vector_t; +} *obj_t; + +extern obj_t create_vector (int); +extern obj_t make_pair (obj_t, obj_t); +extern long bgl_list_length (obj_t); +extern int BGl_equalzf3zf3zz__r4_equivalence_6_2z00 (obj_t, obj_t); +extern obj_t BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t + BgL_formalsz00_39, + obj_t BgL_bodyz00_40, + obj_t BgL_wherez00_41, + obj_t + BgL_namedzf3zf3_42, + obj_t BgL_locz00_43); + +obj_t +BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t BgL_formalsz00_39, + obj_t BgL_bodyz00_40, + obj_t BgL_wherez00_41, + obj_t BgL_namedzf3zf3_42, + obj_t BgL_locz00_43) +{ + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (BgL_formalsz00_39, + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + BgL_tagzd21966zd2_943: + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1042z00_998; + { + int BgL_auxz00_4066; + BgL_auxz00_4066 = (int) (((long) 3)); + BgL_v1042z00_998 = create_vector (BgL_auxz00_4066); + } + { + obj_t BgL_arg1586z00_1000; + BgL_arg1586z00_1000 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4070; + BgL_auxz00_4070 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4070] = + BgL_arg1586z00_1000, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4073; + BgL_auxz00_4073 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4073] = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4078; + int BgL_auxz00_4076; + { + long BgL_auxz00_4079; + { + long BgL_auxz00_4080; + BgL_auxz00_4080 = bgl_list_length (BgL_formalsz00_39); + BgL_auxz00_4079 = (BgL_auxz00_4080 + ((long) 37)); + } + BgL_auxz00_4078 = + (obj_t) ((long) (((long) (BgL_auxz00_4079) << 2) | 1)); + } + BgL_auxz00_4076 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4076] = + BgL_auxz00_4078, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1042z00_998; + } else { + obj_t BgL_v1043z00_1005; + { + int BgL_auxz00_4085; + BgL_auxz00_4085 = (int) (((long) 3)); + BgL_v1043z00_1005 = create_vector (BgL_auxz00_4085); + } + { + int BgL_auxz00_4088; + BgL_auxz00_4088 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4088] = + BgL_bodyz00_40, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4091; + BgL_auxz00_4091 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4091] = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4096; + int BgL_auxz00_4094; + { + long BgL_auxz00_4097; + { + long BgL_auxz00_4098; + BgL_auxz00_4098 = bgl_list_length (BgL_formalsz00_39); + BgL_auxz00_4097 = (BgL_auxz00_4098 + ((long) 42)); + } + BgL_auxz00_4096 = + (obj_t) ((long) (((long) (BgL_auxz00_4097) << 2) | 1)); + } + BgL_auxz00_4094 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4094] = + BgL_auxz00_4096, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1043z00_1005; + } + } else { + if (((((long) BgL_formalsz00_39) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21979zd2_953; + BgL_cdrzd21979zd2_953 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr); + if (((((long) BgL_cdrzd21979zd2_953) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21986zd2_956; + BgL_cdrzd21986zd2_956 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr); + if (((((long) BgL_cdrzd21986zd2_956) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21986zd2_956 - 3))->pair_t). + cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21994zd2_959; + { + obj_t BgL_auxz00_4120; + BgL_auxz00_4120 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). + cdr); + BgL_cdrzd21994zd2_959 = + ((((obj_t) ((long) BgL_auxz00_4120 - 3))->pair_t).cdr); + } + if (((((long) BgL_cdrzd21994zd2_959) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21994zd2_959 - 3))-> + pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + int BgL_testz00_4128; + { + obj_t BgL_auxz00_4129; + BgL_auxz00_4129 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + car); + BgL_testz00_4128 = + ((((long) BgL_auxz00_4129) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4128) { + BgL_tagzd21971zd2_948: + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) + ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1052z00_1026; + { + int BgL_auxz00_4134; + BgL_auxz00_4134 = (int) (((long) 3)); + BgL_v1052z00_1026 = create_vector (BgL_auxz00_4134); + } + { + obj_t BgL_arg1606z00_1028; + { + obj_t BgL_v1053z00_1029; + { + int BgL_auxz00_4137; + BgL_auxz00_4137 = (int) (((long) 3)); + BgL_v1053z00_1029 = + create_vector (BgL_auxz00_4137); + } + { + int BgL_auxz00_4140; + BgL_auxz00_4140 = (int) (((long) 2)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4140] = + BgL_formalsz00_39, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4143; + BgL_auxz00_4143 = (int) (((long) 1)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4143] = + BgL_bodyz00_40, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4146; + BgL_auxz00_4146 = (int) (((long) 0)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4146] = + BgL_wherez00_41, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + BgL_arg1606z00_1028 = BgL_v1053z00_1029; + } + { + int BgL_auxz00_4149; + BgL_auxz00_4149 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4149] = + BgL_arg1606z00_1028, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4152; + BgL_auxz00_4152 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4152] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4157; + int BgL_auxz00_4155; + BgL_auxz00_4157 = + (obj_t) ((long) + (((long) (((long) 55)) << 2) | 1)); + BgL_auxz00_4155 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4155] = + BgL_auxz00_4157, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1052z00_1026; + } else { + obj_t BgL_v1054z00_1030; + { + int BgL_auxz00_4160; + BgL_auxz00_4160 = (int) (((long) 3)); + BgL_v1054z00_1030 = create_vector (BgL_auxz00_4160); + } + { + obj_t BgL_arg1608z00_1032; + BgL_arg1608z00_1032 = + make_pair (BgL_bodyz00_40, BgL_formalsz00_39); + { + int BgL_auxz00_4164; + BgL_auxz00_4164 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4164] = + BgL_arg1608z00_1032, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4167; + BgL_auxz00_4167 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4167] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4172; + int BgL_auxz00_4170; + BgL_auxz00_4172 = + (obj_t) ((long) + (((long) (((long) 56)) << 2) | 1)); + BgL_auxz00_4170 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4170] = + BgL_auxz00_4172, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1054z00_1030; + } + } else { + int BgL_testz00_4175; + { + obj_t BgL_auxz00_4176; + { + obj_t BgL_auxz00_4177; + BgL_auxz00_4177 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4176 = + ((((obj_t) ((long) BgL_auxz00_4177 - 3))->pair_t). + car); + } + BgL_testz00_4175 = + ((((long) BgL_auxz00_4176) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4175) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4181; + { + obj_t BgL_auxz00_4182; + { + obj_t BgL_auxz00_4183; + { + obj_t BgL_auxz00_4184; + BgL_auxz00_4184 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4183 = + ((((obj_t) ((long) BgL_auxz00_4184 - 3))-> + pair_t).cdr); + } + BgL_auxz00_4182 = + ((((obj_t) ((long) BgL_auxz00_4183 - 3))-> + pair_t).car); + } + BgL_testz00_4181 = + ((((long) BgL_auxz00_4182) & ((1 << 2) - 1)) == + 3); + } + if (BgL_testz00_4181) { + goto BgL_tagzd21971zd2_948; + } else { + goto BgL_tagzd21971zd2_948; + } + } + } + } + } else { + int BgL_testz00_4189; + { + obj_t BgL_auxz00_4190; + BgL_auxz00_4190 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + car); + BgL_testz00_4189 = + ((((long) BgL_auxz00_4190) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4189) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4193; + { + obj_t BgL_auxz00_4194; + { + obj_t BgL_auxz00_4195; + BgL_auxz00_4195 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + cdr); + BgL_auxz00_4194 = + ((((obj_t) ((long) BgL_auxz00_4195 - 3))->pair_t). + car); + } + BgL_testz00_4193 = + ((((long) BgL_auxz00_4194) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4193) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4199; + { + obj_t BgL_auxz00_4200; + { + obj_t BgL_auxz00_4201; + { + obj_t BgL_auxz00_4202; + BgL_auxz00_4202 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4201 = + ((((obj_t) ((long) BgL_auxz00_4202 - 3))-> + pair_t).cdr); + } + BgL_auxz00_4200 = + ((((obj_t) ((long) BgL_auxz00_4201 - 3))->pair_t). + car); + } + BgL_testz00_4199 = + ((((long) BgL_auxz00_4200) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4199) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) + ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1050z00_1022; + { + int BgL_auxz00_4209; + BgL_auxz00_4209 = (int) (((long) 3)); + BgL_v1050z00_1022 = + create_vector (BgL_auxz00_4209); + } + { + obj_t BgL_arg1604z00_1024; + BgL_arg1604z00_1024 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4213; + BgL_auxz00_4213 = (int) (((long) 2)); + ((& + (((obj_t) (BgL_v1050z00_1022))->vector_t. + obj0))[BgL_auxz00_4213] = + BgL_arg1604z00_1024, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4216; + BgL_auxz00_4216 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) + [BgL_auxz00_4216] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4221; + int BgL_auxz00_4219; + BgL_auxz00_4221 = + (obj_t) ((long) + (((long) (((long) 50)) << 2) | 1)); + BgL_auxz00_4219 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) + [BgL_auxz00_4219] = + BgL_auxz00_4221, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1050z00_1022; + } else { + obj_t BgL_v1051z00_1025; + { + int BgL_auxz00_4224; + BgL_auxz00_4224 = (int) (((long) 3)); + BgL_v1051z00_1025 = + create_vector (BgL_auxz00_4224); + } + { + int BgL_auxz00_4227; + BgL_auxz00_4227 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4227] = + BgL_bodyz00_40, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4230; + BgL_auxz00_4230 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4230] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4235; + int BgL_auxz00_4233; + BgL_auxz00_4235 = + (obj_t) ((long) + (((long) (((long) 54)) << 2) | 1)); + BgL_auxz00_4233 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4233] = + BgL_auxz00_4235, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1051z00_1025; + } + } + } + } + } + } + } else { + int BgL_testz00_4238; + { + obj_t BgL_auxz00_4239; + BgL_auxz00_4239 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); + BgL_testz00_4238 = + ((((long) BgL_auxz00_4239) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4238) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4242; + { + obj_t BgL_auxz00_4243; + BgL_auxz00_4243 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). + car); + BgL_testz00_4242 = + ((((long) BgL_auxz00_4243) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4242) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1048z00_1018; + { + int BgL_auxz00_4248; + BgL_auxz00_4248 = (int) (((long) 3)); + BgL_v1048z00_1018 = create_vector (BgL_auxz00_4248); + } + { + obj_t BgL_arg1602z00_1020; + BgL_arg1602z00_1020 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4252; + BgL_auxz00_4252 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4252] = + BgL_arg1602z00_1020, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4255; + BgL_auxz00_4255 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4255] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4260; + int BgL_auxz00_4258; + BgL_auxz00_4260 = + (obj_t) ((long) (((long) (((long) 49)) << 2) | 1)); + BgL_auxz00_4258 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4258] = + BgL_auxz00_4260, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1048z00_1018; + } else { + obj_t BgL_v1049z00_1021; + { + int BgL_auxz00_4263; + BgL_auxz00_4263 = (int) (((long) 3)); + BgL_v1049z00_1021 = create_vector (BgL_auxz00_4263); + } + { + int BgL_auxz00_4266; + BgL_auxz00_4266 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4266] = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4269; + BgL_auxz00_4269 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4269] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4274; + int BgL_auxz00_4272; + BgL_auxz00_4274 = + (obj_t) ((long) (((long) (((long) 53)) << 2) | 1)); + BgL_auxz00_4272 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4272] = + BgL_auxz00_4274, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1049z00_1021; + } + } + } + } + } + } else { + int BgL_testz00_4277; + { + obj_t BgL_auxz00_4278; + BgL_auxz00_4278 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); + BgL_testz00_4277 = + ((((long) BgL_auxz00_4278) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4277) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1046z00_1014; + { + int BgL_auxz00_4283; + BgL_auxz00_4283 = (int) (((long) 3)); + BgL_v1046z00_1014 = create_vector (BgL_auxz00_4283); + } + { + obj_t BgL_arg1600z00_1016; + BgL_arg1600z00_1016 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4287; + BgL_auxz00_4287 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4287] = + BgL_arg1600z00_1016, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4290; + BgL_auxz00_4290 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4290] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4295; + int BgL_auxz00_4293; + BgL_auxz00_4295 = + (obj_t) ((long) (((long) (((long) 48)) << 2) | 1)); + BgL_auxz00_4293 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4293] = + BgL_auxz00_4295, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1046z00_1014; + } else { + obj_t BgL_v1047z00_1017; + { + int BgL_auxz00_4298; + BgL_auxz00_4298 = (int) (((long) 3)); + BgL_v1047z00_1017 = create_vector (BgL_auxz00_4298); + } + { + int BgL_auxz00_4301; + BgL_auxz00_4301 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4301] = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4304; + BgL_auxz00_4304 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4304] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4309; + int BgL_auxz00_4307; + BgL_auxz00_4309 = + (obj_t) ((long) (((long) (((long) 52)) << 2) | 1)); + BgL_auxz00_4307 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4307] = + BgL_auxz00_4309, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1047z00_1017; + } + } + } + } + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1044z00_1010; + { + int BgL_auxz00_4314; + BgL_auxz00_4314 = (int) (((long) 3)); + BgL_v1044z00_1010 = create_vector (BgL_auxz00_4314); + } + { + obj_t BgL_arg1598z00_1012; + BgL_arg1598z00_1012 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4318; + BgL_auxz00_4318 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0)) + [BgL_auxz00_4318] = + BgL_arg1598z00_1012, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4321; + BgL_auxz00_4321 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4321] + = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4326; + int BgL_auxz00_4324; + BgL_auxz00_4326 = + (obj_t) ((long) (((long) (((long) 47)) << 2) | 1)); + BgL_auxz00_4324 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4324] + = + BgL_auxz00_4326, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1044z00_1010; + } else { + obj_t BgL_v1045z00_1013; + { + int BgL_auxz00_4329; + BgL_auxz00_4329 = (int) (((long) 3)); + BgL_v1045z00_1013 = create_vector (BgL_auxz00_4329); + } + { + int BgL_auxz00_4332; + BgL_auxz00_4332 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4332] + = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4335; + BgL_auxz00_4335 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4335] + = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4340; + int BgL_auxz00_4338; + BgL_auxz00_4340 = + (obj_t) ((long) (((long) (((long) 51)) << 2) | 1)); + BgL_auxz00_4338 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4338] + = + BgL_auxz00_4340, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1045z00_1013; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-2.c b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c new file mode 100644 index 000000000..9a162d493 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c @@ -0,0 +1,10 @@ +/* This testcase ICEd because a SUBREG of MEM/v was never + simplified. */ +volatile unsigned long long *a; + +unsigned char +foo (void) +{ + unsigned char b = (*a != 0); + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-1.c b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c new file mode 100644 index 000000000..b74061764 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c @@ -0,0 +1,14 @@ +int +sub1 (char *p, int i) +{ + char j = p[i]; + + { + void + sub2 () + { + i = 2; + p = p + 2; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-2.c b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c new file mode 100644 index 000000000..77699e43d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c @@ -0,0 +1,16 @@ +/* This testcase ICEd on IA-32 at -O2, because loop was calling convert_modes + between a MODE_FLOAT and MODE_INT class modes. */ + +typedef union +{ + double d; + long long ll; +} A; + +void +foo (A x, A **y, A z) +{ + for (; *y; y++) + if (x.ll == 262 && (*y)->d == z.d) + break; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020312-1.c b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c new file mode 100644 index 000000000..bb950ff31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c @@ -0,0 +1,25 @@ +/* This does not compile on HC11/HC12 due to the asm which requires + two 32-bit registers. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "" } } */ +/* { dg-skip-if "" { pdp11-*-* } { "-O0" } { "" } } */ + +/* PR optimization/5892 */ +typedef struct { unsigned long a; unsigned int b, c; } A; +typedef struct { unsigned long a; A *b; int c; } B; + +static inline unsigned int +bar (unsigned int x) +{ + unsigned long r; + asm ("" : "=r" (r) : "0" (x)); + return r >> 31; +} + +int foo (B *x) +{ + A *y; + y = x->b; + y->b = bar (x->c); + y->c = ({ unsigned int z = 1; (z << 24) | (z >> 24); }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020314-1.c b/gcc/testsuite/gcc.c-torture/compile/20020314-1.c new file mode 100644 index 000000000..b21eb14f8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020314-1.c @@ -0,0 +1,26 @@ +typedef struct tux_req_struct tux_req_t; +struct tux_req_struct +{ + struct socket *sock; + char usermode; + char *userbuf; + unsigned int userlen; + char error; + void *private; +}; +void user_send_buffer (tux_req_t *req, int cachemiss) +{ + int ret; +repeat: + switch (ret) { + case -11: + if (add_output_space_event(req, req->sock)) { + del_tux_atom(req); + goto repeat; + } + do { } while (0); + break; + default: + add_req_to_workqueue(req); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020315-1.c b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c new file mode 100644 index 000000000..c6c9daa2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c @@ -0,0 +1,34 @@ +/* PR bootstrap/4128 */ + +extern int bar (char *, char *, int, int); +extern long baz (char *, char *, int, int); + +int sgt (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) > 0; +} + +long dgt (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) > 0; +} + +int sne (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) != 0; +} + +long dne (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) != 0; +} + +int seq (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) == 0; +} + +long deq (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020318-1.c b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c new file mode 100644 index 000000000..097a35d79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c @@ -0,0 +1,16 @@ +/* PR c/5656 + This testcase ICEd on IA-32 at -O3, due to tree inliner not converting + parameter assignment when using K&R syntax. */ + +void foo (c) + char c; +{ + (void) &c; +} + +int bar (void); + +void baz (void) +{ + foo (bar ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020319-1.c b/gcc/testsuite/gcc.c-torture/compile/20020319-1.c new file mode 100644 index 000000000..be5b9c2fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020319-1.c @@ -0,0 +1,20 @@ +/* This testcase ICEd in combine.c:do_SUBST() self-test for sign-extended +CONST_INT because expr.c:expand_expr() was not sign-extending array index +into constant strings. */ + +typedef unsigned char uch; +extern uch outbuf[]; +extern unsigned outcnt; + +extern void flush_outbuf (void); + +int zip(void) +{ + outcnt = 0; + + {outbuf[outcnt++]=(uch)("\037\213"[0]); if (outcnt==16384) flush_outbuf();}; + {outbuf[outcnt++]=(uch)("\037\213"[1]); if (outcnt==16384) flush_outbuf();}; + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c new file mode 100644 index 000000000..385c061e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c @@ -0,0 +1,24 @@ +/* PR bootstrap/4192 + This testcase caused infinite loop in flow (several places), + because flow assumes gen_jump generates simple_jump_p. */ + +typedef void (*T) (void); +extern T x[]; + +void +foo (void) +{ + static T *p = x; + static _Bool a; + T f; + + if (__builtin_expect (a, 0)) + return; + + while ((f = *p)) + { + p++; + f (); + } + a = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020323-1.c b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c new file mode 100644 index 000000000..ed3c66651 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c @@ -0,0 +1,26 @@ +/* This testcase caused ICE on powerpc at -O3, because regrename did + not handle match_dup of match_operator if the RTLs were not shared. */ + +struct A +{ + unsigned char *a0, *a1; + int a2; +}; + +void bar (struct A *); + +unsigned int +foo (int x) +{ + struct A a; + unsigned int b; + + if (x < -128 || x > 255 || x == -1) + return 26; + + a.a0 = (unsigned char *) &b; + a.a1 = a.a0 + sizeof (unsigned int); + a.a2 = 0; + bar (&a); + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020330-1.c b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c new file mode 100644 index 000000000..cac709912 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c @@ -0,0 +1,27 @@ +/* PR 5446 */ +/* This testcase is similar to gcc.c-torture/compile/20011219-1.c except + with parts of it omitted, causing an ICE with -O3 on IA-64. */ + +void * baz (unsigned long); +static inline double ** +bar (long w, long x, long y, long z) +{ + long i, a = x - w + 1, b = z - y + 1; + double **m = (double **) baz (sizeof (double *) * (a + 1)); + + m += 1; + m -= w; + m[w] = (double *) baz (sizeof (double) * (a * b + 1)); + for (i = w + 1; i <= x; i++) + m[i] = m[i - 1] + b; + return m; +} + +void +foo (double w[], int x, double y[], double z[]) +{ + int i; + double **a; + + a = bar (1, 50, 1, 50); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020409-1.c b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c new file mode 100644 index 000000000..1bdc08ff3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c @@ -0,0 +1,9 @@ +/* PR c/5078 */ + +#include <limits.h> + +int f(int i) +{ + i -= 2 * (INT_MAX + 1); + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020415-1.c b/gcc/testsuite/gcc.c-torture/compile/20020415-1.c new file mode 100644 index 000000000..95cdc1eaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020415-1.c @@ -0,0 +1,22 @@ +/* Check that floating point casts of integer operations don't ICE. */ +/* The first of these routines caused problems for a patch, that wasn't + otherwise caught by a full bootstrap, the regression test suite or + SPEC CPU2000. */ + +double +andop (unsigned int x) +{ + return x & 1; +} + +double +orop (unsigned int x) +{ + return x | 1; +} + +double +notop (unsigned int x) +{ + return ~x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020418-1.c b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c new file mode 100644 index 000000000..df01e6847 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c @@ -0,0 +1,18 @@ +/* PR c/6358 + This testcase ICEd on IA-32 in foo, because current_function_return_rtx + was assigned a hard register only after expand_null_return was called, + thus return pseudo was clobbered twice and the hard register not at + all. */ + +void baz (void); + +double foo (void) +{ + baz (); + return; +} + +double bar (void) +{ + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020530-1.c b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c new file mode 100644 index 000000000..a6794892e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c @@ -0,0 +1,16 @@ +/* PR optimization/6822 */ + +extern unsigned char foo1 (void); +extern unsigned short foo2 (void); + +int bar1 (void) +{ + unsigned char q = foo1 (); + return (q < 0x80) ? 64 : 0; +} + +int bar2 (void) +{ + unsigned short h = foo2 (); + return (h < 0x8000) ? 64 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c new file mode 100644 index 000000000..8b958040e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c @@ -0,0 +1,93 @@ +/* { dg-do assemble } */ +/* { dg-xfail-if "The array is too big" { "m6811-*-* m6812-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ +/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */ +/* { dg-skip-if "" { m32c-*-* } { } { } } */ + +/* PR c/6957 + This testcase ICEd at -O2 on IA-32, because + (insn 141 139 142 (set (subreg:SF (reg:QI 72) 0) + (plus:SF (reg:SF 73) + (reg:SF 76))) 525 {*fop_sf_comm_nosse} (insn_list 134 (nil)) + (expr_list:REG_DEAD (reg:SF 73) (nil))) + couldn't be reloaded. */ + +void +foo (unsigned int n, int x, int y, unsigned char *z) +{ + int a, b; + float c[2048][4]; + + switch (x) + { + case 0x1906: + a = b = -1; + break; + case 0x190A: + a = b = -1; + break; + case 0x8049: + a = b = -1; + break; + case 0x1907: + a = 1; + b = 2; + break; + default: + return; + } + + if (a >= 0) + { + unsigned char *d = z; + unsigned int i; + for (i = 0; i < n; i++) + { + do + { + union + { + float r; + unsigned int i; + } + e; + e.r = c[i][1]; + d[a] = + ((e.i >= 0x3f7f0000) ? ((int) e.i < + 0) ? (unsigned char) 0 + : (unsigned char) 255 : (e.r = + e.r * (255.0F / 256.0F) + + 32768.0F, (unsigned char) e.i)); + } + while (0); + d += y; + } + } + + if (b >= 0) + { + unsigned char *d = z; + unsigned int i; + for (i = 0; i < n; i++) + { + do + { + union + { + float r; + unsigned int i; + } + e; + e.r = c[i][2]; + d[b] = + ((e.i >= 0x3f7f0000) ? ((int) e.i < + 0) ? (unsigned char) 0 + : (unsigned char) 255 : (e.r = + e.r * (255.0F / 256.0F) + + 32768.0F, (unsigned char) e.i)); + } + while (0); + d += y; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020605-1.c b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c new file mode 100644 index 000000000..960a4be7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c @@ -0,0 +1,17 @@ +/* This testcase caused on IA-32 -O2 endless loop in + merge_blocks when trying to merge a basic block + with itself. */ + +void f (void) +{ + char *c; + do + { + if (c) + break; + } + while (1); + if (!c) + while (1) + f (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c new file mode 100644 index 000000000..1258cec28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c @@ -0,0 +1,75 @@ +/* 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 *); +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; + char *a; + char *v3; + char *v4; + char *v5; + char *e; + char *v6; + t1 r = C; + + v1 = f2 (p2); + v4 = f2 (p1); + + a = v2 = v1; + e = v5 = v4; + memcpy (&e, &e, sizeof (e)); + + v3 = strchr (v2, ','); + v6 = strchr (v5, ','); + + while ((_v + 1)[(unsigned) *a] & 4) + a++; + while ((_v + 1)[(unsigned) *e] & 4) + e++; + + if (a == v3 && e == v6) + { + if (p3) + r = atoi (v5) < atoi (v2) ? B : A; + else + r = atoi (v5) > atoi (v2) ? B : A; + v2 = ++a; + v5 = ++e; + v3 = strchr (v2, ','); + v6 = strchr (v5, ','); + + while ((_v + 1)[(unsigned) *a] & 4) + a++; + while ((_v + 1)[(unsigned) *e] & 4) + e++; + + if (a == v3 && e == v6) + { + if (r == B) + r = B; + else if (p3) + r = atoi (v5) < atoi (v2) ? B : A; + else + r = atoi (v5) > atoi (v2) ? B : A; + } + else + r = C; + } + + f1 (v1); + f1 (v4); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-1.c b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c new file mode 100644 index 000000000..c8811bc68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c @@ -0,0 +1,50 @@ +// Contributed by Alexandre Oliva <aoliva@redhat.com> +// From Red Hat case 106165. + +typedef struct s1 +{ + unsigned short v1; + unsigned char *v2; +} S1; + +extern void bar(const struct s1 *const hdb); +extern unsigned char* foo (); + +unsigned int sn; +S1 *hdb; +S1 *pb; +unsigned short len; + +unsigned int crashIt() +{ + unsigned char *p; + unsigned int nsn; + unsigned short cnt; + + if (sn != 0) return 1; + + if ((len < 12) || ((p = (((pb->v1) >= 8) ? pb->v2 : foo() )) == 0)) + return 1; + + nsn = ( + (((*(unsigned int*)p) & 0x000000ff) << 24) | + (((*(unsigned int*)p) & 0x0000ff00) << 8) | + (((*(unsigned int*)p) & 0x00ff0000) >> 8) | + (((*(unsigned int*)p) & 0xff000000) >> 24) ); + p += 4; + + cnt = (unsigned short) (( + (((*(unsigned int*)p) & 0x000000ff) << 24) | + (((*(unsigned int*)p) & 0x0000ff00) << 8) | + (((*(unsigned int*)p) & 0x00ff0000) >> 8) | + (((*(unsigned int*)p) & 0xff000000) >> 24) ) & + 0xffff); + + if ((len != 12 + (cnt * 56)) || (nsn == 0)) + { + bar(hdb); + return 1; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-2.c b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c new file mode 100644 index 000000000..b84dda60f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c @@ -0,0 +1,26 @@ +// Contributed by Alexandre Oliva <aoliva@redhat.com> +// From Red Hat case 106165. + +typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short); + +void crashIt(int id, FUNC_P *func, unsigned char *funcparm) +{ + unsigned char buff[5], reverse[4]; + unsigned char *bp = buff; + unsigned char *rp = reverse; + unsigned short int count = 0; + unsigned short cnt; + while (id > 0) + { + *rp++ = (unsigned char) (id & 0x7F); + id >>= 7; + count++; + } + cnt = count + 1; + while ((count--) > 1) + { + *bp++ = (unsigned char)(*(--rp) | 0x80); + } + *bp++ = *(--rp); + (void)(*func)(funcparm, buff, cnt); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020709-1.c b/gcc/testsuite/gcc.c-torture/compile/20020709-1.c new file mode 100644 index 000000000..af0e1ddf4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020709-1.c @@ -0,0 +1,7 @@ +extern double atof (__const char *__nptr) __attribute__ ((__pure__)); + +void bar (char *s) +{ + union {double val; unsigned int a, b;} u; + u.val = atof (s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020710-1.c b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c new file mode 100644 index 000000000..bf6c9066c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c @@ -0,0 +1,12 @@ +/* Red Hat bugzilla #68395 + PR middle-end/7245 + This testcase ICEd on IA-32 because shift & compare patterns + predicates allowed any immediate, but constraints allowed only + numbers from 1 to 31. */ + +void foo (int *x, unsigned int y) +{ + int a = y >> -13; + if (a) + *x = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020715-1.c b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c new file mode 100644 index 000000000..5294133f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c @@ -0,0 +1,22 @@ +/* PR optimization/7153 */ +/* Verify that GCC doesn't promote a register when its + lifetime is not limited to one basic block. */ + +void f(char); +void g(void); + +void scale(void) +{ + int width; + char bytes; + char *src; + + if (width) + { + bytes = *src; + g(); + width *= bytes; + } + + f(bytes); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020807-1.c b/gcc/testsuite/gcc.c-torture/compile/20020807-1.c new file mode 100644 index 000000000..c1cc81504 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020807-1.c @@ -0,0 +1,33 @@ +int x; + +static int +__attribute__ ((noinline)) +foo (void) +{ + return 0; +} + +static void +__attribute__ ((noinline)) +bar (void) +{ +} + +static inline void +baz (void) +{ + char arr[x]; + +lab: + if (foo () == -1) + { + bar (); + goto lab; + } +} + +void +test (void) +{ + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020910-1.c b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c new file mode 100644 index 000000000..092809b76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c @@ -0,0 +1,19 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else +unsigned int x0 = 0; + +typedef struct { + unsigned int field1 : 20; + unsigned int field2 : 12; +} XX; + +static XX yy; + +static void foo (void) +{ + yy.field1 = (unsigned int ) (&x0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20020926-1.c b/gcc/testsuite/gcc.c-torture/compile/20020926-1.c new file mode 100644 index 000000000..260e84454 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020926-1.c @@ -0,0 +1,21 @@ +/* PR c/7160 */ +/* Verify that the register-to-stack converter properly handles + branches without return value containing function calls. */ + +extern int gi; + +extern int foo1(int, int); +extern void foo2(int, int); +extern float foo3(int); + +float bar(int i1, int i2) +{ + int i3; + + if (i2) { + i3 = foo1(i1, gi); + foo2(i1, i3); + } + else + return foo3(i2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020927-1.c b/gcc/testsuite/gcc.c-torture/compile/20020927-1.c new file mode 100644 index 000000000..b93d8a18d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020927-1.c @@ -0,0 +1,26 @@ +/* PR optimization/7520 */ +/* ICE at -O3 on x86 due to register life problems caused by + the return-without-value in bar. */ + +int +foo () +{ + int i; + long long int j; + + while (1) + { + if (j & 1) + ++i; + j >>= 1; + if (j) + return i; + } +} + +int +bar () +{ + if (foo ()) + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020930-1.c b/gcc/testsuite/gcc.c-torture/compile/20020930-1.c new file mode 100644 index 000000000..d2fa3748a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020930-1.c @@ -0,0 +1,10 @@ +/* PR c/8002 */ + +float expm1f(float x) { + union { + float value; + unsigned word; + } sf_u; + sf_u.word = (unsigned) x * 2; + return x + sf_u.value; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021001-1.c b/gcc/testsuite/gcc.c-torture/compile/20021001-1.c new file mode 100644 index 000000000..9f0f9c097 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021001-1.c @@ -0,0 +1,4 @@ +int foo (double x, double y) +{ + return !__builtin_isunordered (x, y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021007-1.c b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c new file mode 100644 index 000000000..de4c0defa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c @@ -0,0 +1,11 @@ +/* PR c/7411 */ +/* Verify that GCC simplifies the null addition to i before + virtual register substitution tries it and winds up with + a memory to memory move. */ + +void foo () +{ + int i = 0,j; + + i+=j=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021008-1.c b/gcc/testsuite/gcc.c-torture/compile/20021008-1.c new file mode 100644 index 000000000..9d5a7f276 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021008-1.c @@ -0,0 +1,11 @@ +/* Origin: PR target/7434 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> */ + +int main(void) +{ + static const int align_g[] = { 1, 2, 4, 8, 16 }; + char * buf; + int i = 0; + volatile long double val = 0; + val = *((long double *)(buf + align_g[i])); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-1.c b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c new file mode 100644 index 000000000..789b8a8b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c @@ -0,0 +1,12 @@ +/* PR target/7370. */ + +int g (int *x, int *y); + +void f () +{ + int x, y; + char a[4000]; + + g (&x, &y); + x = x/y + x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-2.c b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c new file mode 100644 index 000000000..6b158c5bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c @@ -0,0 +1,7 @@ +/* PR target/8232. */ + +int f (char *p, char *q, int i) +{ + return bcmp (p, q, i); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20021103-1.c b/gcc/testsuite/gcc.c-torture/compile/20021103-1.c new file mode 100644 index 000000000..82802001a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021103-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/8408 */ +/* Verify that the recognizer explicitly + handles ADDRESSOF operands. */ + +void foo(void) +{ + double d1 = 3.14159, d2; + if (&d2 == &d1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c new file mode 100644 index 000000000..01b6e4ed7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c @@ -0,0 +1,7 @@ +int +main() +{ +l1: + return &&l1-&&l2; +l2:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021110.c b/gcc/testsuite/gcc.c-torture/compile/20021110.c new file mode 100644 index 000000000..dd2aa7e09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021110.c @@ -0,0 +1,10 @@ +/* PR c/8439 */ +/* Verify that GCC properly handles null increments. */ + +struct empty { +}; + +void foo(struct empty *p) +{ + p++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021119-1.c b/gcc/testsuite/gcc.c-torture/compile/20021119-1.c new file mode 100644 index 000000000..d4306b89b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021119-1.c @@ -0,0 +1,11 @@ +/* PR c/8588 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that GCC converts integer constants + in shift operations. */ + +void foo() +{ + unsigned int i, j; + j = (i >> 0xf0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021120-1.c b/gcc/testsuite/gcc.c-torture/compile/20021120-1.c new file mode 100644 index 000000000..423f8ec19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021120-1.c @@ -0,0 +1,9 @@ +/* PR c/8518 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that GCC doesn't get confused by the + redefinition of an extern inline function. */ + +extern int inline foo () { return 0; } +extern int inline bar () { return 0; } +static int inline bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021120-2.c b/gcc/testsuite/gcc.c-torture/compile/20021120-2.c new file mode 100644 index 000000000..51f0e257d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021120-2.c @@ -0,0 +1,9 @@ +/* PR c/8518 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that GCC doesn't get confused by the + redefinition of an extern inline function. */ + +extern int inline foo () { return 0; } +extern int inline bar () { return 0; } +static int bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021124-1.c b/gcc/testsuite/gcc.c-torture/compile/20021124-1.c new file mode 100644 index 000000000..3ab2b2ef4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021124-1.c @@ -0,0 +1,7 @@ +/* PR optimization/8275 */ +/* Contributed by Volker Reichelt. */ + +unsigned int foo (unsigned int u) +{ + return (u >> 32) & 0xffff; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021204-1.c b/gcc/testsuite/gcc.c-torture/compile/20021204-1.c new file mode 100644 index 000000000..4e8d3fefc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021204-1.c @@ -0,0 +1,16 @@ +/* PR c/7622 */ + +/* Verify that GCC can handle the mix of + extern inline and nested functions. */ + +extern inline int t() +{ + int q() { return 0; } + + return q(); +} + +int foo() +{ + return t(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021205-1.c b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c new file mode 100644 index 000000000..73648e949 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c @@ -0,0 +1,9 @@ +typedef struct x x; +extern void *baz(char *); +struct x { char * (*bar) (int); }; +static x **foo() { return ((x**)baz(0)); } +int xyzzy() +{ + baz((*foo())->bar(0)); + return 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021212-1.c b/gcc/testsuite/gcc.c-torture/compile/20021212-1.c new file mode 100644 index 000000000..b89669d75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021212-1.c @@ -0,0 +1,15 @@ +/* PR optimization/8334 */ +/* Verify that GCC produces valid operands + after simplifying an addition. */ + +void foo(int m, int n, double *f) +{ + int i, j, k = 1; + + for (j = 0; j < n; j++) { + for (i = k; i < m; i++) { + f[i] = (double) (i * j); + f[i + j] = (double) ((i + 1) * j); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021230-1.c b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c new file mode 100644 index 000000000..45ab51fd5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c @@ -0,0 +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; + +static void initRGB() +{ + t = ((r*255/3) & 0xff) << 16; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030109-1.c b/gcc/testsuite/gcc.c-torture/compile/20030109-1.c new file mode 100644 index 000000000..4df7d1872 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030109-1.c @@ -0,0 +1,6 @@ +void foo () +{ + int x1, x2, x3; + + bar (&x2 - &x1, &x3 - &x2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030110-1.c b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c new file mode 100644 index 000000000..1cbbaea3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c @@ -0,0 +1,39 @@ +extern char bpp; + +void foo() +{ + if (bpp == 32) + { + if (2 < 8) + { + do + { + while (inb(0x9ae8) & (0x0100 >> (2 +1))); + } + while(0); + } + else + { + do + { + while (inb(0x9ae8) & (0x0100 >> (2))); + } + while(0); + } + } + else + do + { + while (inb(0x9ae8) & (0x0100 >> (1))); + } + while(0); + if (8 < 8) + { + do + { + while (inb(0x9ae8) & (0x0100 >> (8 +1))); + } + while(0); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030125-1.c b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c new file mode 100644 index 000000000..656304e2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c @@ -0,0 +1,24 @@ + int count; + + int func(int *valp) { + int val, locked = 0; + + while ((val = *valp) != 0) { + if (count) { + if (count) + locked = 1; + else + locked = 1; + + if (!locked) + continue; + } + + if (!count) + count--; + + break; + } + + return val; + } diff --git a/gcc/testsuite/gcc.c-torture/compile/20030206-1.c b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c new file mode 100644 index 000000000..1e0d54458 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c @@ -0,0 +1,14 @@ +/* PR c/9530 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that the call to 'foo' is not turned + into a sibling call. */ + +void foo(float d); + +float bar(float d); + +float baz(float d) +{ + foo(bar(d)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030216-1.c b/gcc/testsuite/gcc.c-torture/compile/20030216-1.c new file mode 100644 index 000000000..8f692f092 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030216-1.c @@ -0,0 +1,42 @@ +/* PR c/8086 */ + +#define P(x) \ + (((((((((((((((((((((((((((((((( \ + (x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) + +int +polynomial(int a) +{ + return P(3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c new file mode 100644 index 000000000..ecc943f77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c @@ -0,0 +1,6 @@ +int global_one; + +void clobber_register() +{ + *(volatile unsigned char *)(0xE0000000 * global_one) = 0x00; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030220-1.c b/gcc/testsuite/gcc.c-torture/compile/20030220-1.c new file mode 100644 index 000000000..59a03e42c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030220-1.c @@ -0,0 +1,20 @@ +/* PR optimization/9768 */ +/* Originator: Randolph Chung <tausq@debian.org> */ + +inline int fixfloor (long x) +{ + if (x >= 0) + return (x >> 16); + else + return ~((~x) >> 16); +} + +inline int fixtoi (long x) +{ + return fixfloor(x) + ((x & 0x8000) >> 15); +} + +int foo(long x, long y) +{ + return fixtoi(x*y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030224-1.c b/gcc/testsuite/gcc.c-torture/compile/20030224-1.c new file mode 100644 index 000000000..6832dc81e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030224-1.c @@ -0,0 +1,17 @@ +void zzz (char *s1, char *s2, int len, int *q) +{ + int z = 5; + unsigned int i, b; + struct { char a[z]; } x; + + for (i = 0; i < len; i++) + s1[i] = s2[i]; + + b = z & 0x3; + + len += (b == 0 ? 0 : 1) + z; + + *q = len; + + foo (x, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030305-1.c b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c new file mode 100644 index 000000000..2f608196f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c @@ -0,0 +1,18 @@ +/* PR c/9799 */ +/* Verify that GCC doesn't crash on excess elements + in initializer for a flexible array member. */ + +typedef struct { + int aaa; +} s1_t; + +typedef struct { + int bbb; + s1_t s1_array[]; +} s2_t; + +static s2_t s2_array[]= { + { 1, 4 }, + { 2, 5 }, + { 3, 6 } +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20030310-1.c b/gcc/testsuite/gcc.c-torture/compile/20030310-1.c new file mode 100644 index 000000000..0e89e0bfc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030310-1.c @@ -0,0 +1,13 @@ +static inline void +foo (char accept) +{ + char s; + while (s == accept) ; +} + +static void +bar (void) +{ + char ch; + foo (ch); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030314-1.c b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c new file mode 100644 index 000000000..02d4fed52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c @@ -0,0 +1,18 @@ +/* PR optimization/8396 */ +/* Originator: <papadopo@shfj.cea.fr> */ + +/* Verify that the tree inliner doesn't mess up the types + when passing the value of read-only constant arguments. */ + +static inline bar(const short int xs, const short int xe) +{ + if (xe && (xs < xe)) + ; +} + +void f() +{ + short int xe; + + bar(0, xe); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030319-1.c b/gcc/testsuite/gcc.c-torture/compile/20030319-1.c new file mode 100644 index 000000000..dc5ab5774 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030319-1.c @@ -0,0 +1,14 @@ +/* PR 10073 */ +typedef struct +{ + unsigned short digits[4]; +} INT_64; + +INT_64 int_64_com (INT_64 a) +{ + a.digits[0] ^= 0xFFFF; + a.digits[1] ^= 0xFFFF; + a.digits[2] ^= 0xFFFF; + a.digits[3] ^= 0xFFFF; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030320-1.c b/gcc/testsuite/gcc.c-torture/compile/20030320-1.c new file mode 100644 index 000000000..72d0d0966 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030320-1.c @@ -0,0 +1,44 @@ +/* Failed on powerpc64-linux with a segfault due to ifcvt generating + conditional returns without updating dominance info. + Extracted from glibc's dl-load.c. */ + +typedef __SIZE_TYPE__ size_t; + +static size_t +is_dst (const char *start, const char *name, const char *str, + int is_path, int secure) +{ + size_t len; + _Bool is_curly = 0; + + if (name[0] == '{') + { + is_curly = 1; + ++name; + } + + len = 0; + while (name[len] == str[len] && name[len] != '\0') + ++len; + + if (is_curly) + { + if (name[len] != '}') + return 0; + + + --name; + + len += 2; + } + else if (name[len] != '\0' && name[len] != '/' + && (!is_path || name[len] != ':')) + return 0; + + if (__builtin_expect (secure, 0) + && ((name[len] != '\0' && (!is_path || name[len] != ':')) + || (name != start + 1 && (!is_path || name[-2] != ':')))) + return 0; + + return len; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030323-1.c b/gcc/testsuite/gcc.c-torture/compile/20030323-1.c new file mode 100644 index 000000000..8ea602dee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030323-1.c @@ -0,0 +1,17 @@ +/* PR c/10178. The following code would ICE because we didn't check for + overflow when computing the range of the switch-statment, and therefore + decided it could be implemented using bit-tests. */ + +int +banana(long citron) +{ + switch (citron) { + case 0x80000000: + case 0x40000: + case 0x40001: + return 1; + break; + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030330-1.c b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c new file mode 100644 index 000000000..a5d5de23b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c @@ -0,0 +1,7 @@ +/* PR c/10083 */ +/* This will result in a very small constant for umul_highpart, which + uncovered a bug in the Alpha machine description. */ + +unsigned long f(unsigned long x) { + return x % 0x3fffffffffffffff; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030331-1.c b/gcc/testsuite/gcc.c-torture/compile/20030331-1.c new file mode 100644 index 000000000..e5db36bf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030331-1.c @@ -0,0 +1,13 @@ +/* From PR/9301. Fixed by ebotcazou's patch for PR/9493. */ + +void bar (void); + +void foo (int a, int b, int c, int d, int e) +{ + if (a) + bar(); + if (b && c) + ; + if (d && e) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c new file mode 100644 index 000000000..0bdafb923 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c @@ -0,0 +1,30 @@ +/* When compiled with -pedantic, this program will cause an ICE when the + constant propagator tries to set the value of *str to UNDEFINED. + + This happens because *str is erroneously considered as a store alias. + The aliasing code is then making *str an alias leader for its alias set + and when the PHI node at the end of the while() is visited the first + time, CCP will try to assign it a value of UNDEFINED, but the default + value for *str is a constant. */ +typedef __SIZE_TYPE__ size_t; +size_t strlength (const char * const); +char foo(); + +static const char * const str = "mingo"; + +bar() +{ + size_t c; + char *x; + + c = strlength (str); + while (c < 10) + { + if (c > 5) + *x = foo (); + if (*x < 'a') + break; + } + + return *x == '3'; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030410-1.c b/gcc/testsuite/gcc.c-torture/compile/20030410-1.c new file mode 100644 index 000000000..9127ede83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030410-1.c @@ -0,0 +1,27 @@ +/* PR 10201 */ + +extern struct _zend_compiler_globals compiler_globals; +typedef struct _zend_executor_globals zend_executor_globals; +extern zend_executor_globals executor_globals; + +typedef struct _zend_ptr_stack { + int top; + void **top_element; +} zend_ptr_stack; +struct _zend_compiler_globals { +}; +struct _zend_executor_globals { + int *uninitialized_zval_ptr; + zend_ptr_stack argument_stack; +}; + +static inline void safe_free_zval_ptr(int *p) +{ + if (p!=(executor_globals.uninitialized_zval_ptr)) { + } +} +zend_executor_globals executor_globals; +static inline void zend_ptr_stack_clear_multiple(void) +{ + executor_globals.argument_stack.top -= 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030415-1.c b/gcc/testsuite/gcc.c-torture/compile/20030415-1.c new file mode 100644 index 000000000..bcca4c85d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030415-1.c @@ -0,0 +1,4 @@ +float g(float f) +{ + return fabs(f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030416-1.c b/gcc/testsuite/gcc.c-torture/compile/20030416-1.c new file mode 100644 index 000000000..c3d18b682 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030416-1.c @@ -0,0 +1,16 @@ +void foo(int x) +{ + if (x > 3) + {;} + else + bar(); + x = 9; +} + +main() +{ + int j; + + foo(j); + return j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030418-1.c b/gcc/testsuite/gcc.c-torture/compile/20030418-1.c new file mode 100644 index 000000000..f6d5a4af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030418-1.c @@ -0,0 +1,16 @@ +/* PR optimization/7675 */ +/* Contributed by Volker Reichelt */ + +/* Verify that we don't put automatic variables + in registers too early. */ + +extern int dummy (int *); + +void foo(int i) +{ + int j=i; + + void bar() { int x=j, y=i; } + + dummy(&i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030503-1.c b/gcc/testsuite/gcc.c-torture/compile/20030503-1.c new file mode 100644 index 000000000..3c2b28d83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030503-1.c @@ -0,0 +1,12 @@ +void foo () +{ + if (1) + goto foo; + else + for (;;) + { + foo: + bar (); + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030518-1.c b/gcc/testsuite/gcc.c-torture/compile/20030518-1.c new file mode 100644 index 000000000..8cf203451 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030518-1.c @@ -0,0 +1,14 @@ +/* Test case from PR middle-end/10472 */ + +extern void f (char *); + +void foo (char *s) +{ + f (__builtin_stpcpy (s, "hi")); +} + +void bar (char *s) +{ + f (__builtin_mempcpy (s, "hi", 3)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030530-1.c b/gcc/testsuite/gcc.c-torture/compile/20030530-1.c new file mode 100644 index 000000000..b479ea22b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030530-1.c @@ -0,0 +1,23 @@ +union tree_node; +typedef union tree_node *tree; +struct tree_common +{ + tree type; + unsigned lang_flag_0 : 1; +}; +union tree_node +{ + struct tree_common common; +}; +static void +java_check_regular_methods (tree class_decl) +{ + int saw_constructor = class_decl->common.type->common.lang_flag_0; + tree class = class_decl->common.type; + for (;;) + { + if (class) + if (class_decl->common.type) + bar (class); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030530-3.c b/gcc/testsuite/gcc.c-torture/compile/20030530-3.c new file mode 100644 index 000000000..0a93d2f13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030530-3.c @@ -0,0 +1,16 @@ +struct tree_decl +{ + unsigned in_system_header_flag:1; +}; +union tree_node +{ + struct tree_decl decl; +}; +typedef union tree_node *tree; +static int +redeclaration_error_message (olddecl) + tree olddecl; +{ + if (({olddecl;})->decl.in_system_header_flag) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030604-1.c b/gcc/testsuite/gcc.c-torture/compile/20030604-1.c new file mode 100644 index 000000000..7e36bfeb3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030604-1.c @@ -0,0 +1,18 @@ +/* PR optimization/10876 */ +/* Contributed by Christian Ehrhardt */ + +/* Verify that the SPARC port doesn't emit + (minus) (reg) (const_int) insns. */ + +void f(void) +{ + unsigned int butterfly, block, offset; + double *Z; + + for (block = 0; block < 512; block += 512) { + double T1re, T2re; + offset = butterfly + block; + T1re += T2re; + T2re = Z[offset] + T1re; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030605-1.c b/gcc/testsuite/gcc.c-torture/compile/20030605-1.c new file mode 100644 index 000000000..f5e102318 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030605-1.c @@ -0,0 +1,12 @@ +/* Test for proper preparation of the comparison operands for + generation of a conditional trap. Produced unrecognizable + rtl on Sparc. */ + +struct blah { char *b_data; }; + +void set_bh_page(struct blah *bh, unsigned long offset) +{ + if ((1UL << 12 ) <= offset) + __builtin_trap() ; + bh->b_data = (char *)offset; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030612-1.c b/gcc/testsuite/gcc.c-torture/compile/20030612-1.c new file mode 100644 index 000000000..8edbd92bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030612-1.c @@ -0,0 +1,11 @@ +static inline void +foo (long long const v0, long long const v1) +{ + bar (v0 == v1); +} + +void +test (void) +{ + foo (0, 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030624-1.c b/gcc/testsuite/gcc.c-torture/compile/20030624-1.c new file mode 100644 index 000000000..9c293fc34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030624-1.c @@ -0,0 +1,6 @@ +/* Derived from PR optimization/11311 */ + +double pow(double, double); + +double foo(double x) { return pow(x,261); } + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030703-1.c b/gcc/testsuite/gcc.c-torture/compile/20030703-1.c new file mode 100644 index 000000000..4b45f5e57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030703-1.c @@ -0,0 +1,10 @@ +/* Extracted from PR target/10700. */ +/* The following code used to cause an ICE on 64-bit targets. */ + +int SAD_Block(int *); +void MBMotionEstimation(int *act_block, int block) +{ + SAD_Block(act_block + ( (8 * (block == 1 || block == 3)) + + (8 * (block == 2 || block == 3)))); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030704-1.c b/gcc/testsuite/gcc.c-torture/compile/20030704-1.c new file mode 100644 index 000000000..101355c8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030704-1.c @@ -0,0 +1,17 @@ +/* PR c/11428. */ + +/* fold_single_bit_test() failed to return a tree of the type that the + outer expression was looking for. Specifically, it returned a tree + whose type corresponded to QImode for !p->m, but the desired result + type was int, which corresponded to SImode. emit_move_insn() later + tried to copy a reg:QI to reg:SI, causing an ICE. */ + +struct s { + int m : 1; +}; + +int +foo (struct s *p) +{ + return !p->m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030707-1.c b/gcc/testsuite/gcc.c-torture/compile/20030707-1.c new file mode 100644 index 000000000..8ce964512 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030707-1.c @@ -0,0 +1,13 @@ +/* PR c/11449. */ + +/* sign_bit_p() in fold-const.c failed to notice that (int) 0x80000000 + was the sign bit of m. As a result, fold_single_bit_test() + returned ((unsigned int) m >> 31), and that was eventually passed + to invert_truthvalue(), which did not know how to handle + RROTATE_EXPR, causing an ICE. */ + +int +foo (int m) +{ + return !(m & ((int) 0x80000000)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030708-1.c b/gcc/testsuite/gcc.c-torture/compile/20030708-1.c new file mode 100644 index 000000000..5a693d8f7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030708-1.c @@ -0,0 +1,13 @@ +/* PR 10795. */ + +/* ix86_expand_carry_flag_compare() in i386.c swapped the comparison + operands without checking that the compare instruction, cmpl, would + accept the swapped operands. */ + +extern const char a[]; + +int +foo (const char *p) +{ + return (p > a) ? 0 : 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030716-1.c b/gcc/testsuite/gcc.c-torture/compile/20030716-1.c new file mode 100644 index 000000000..ceb4b6171 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030716-1.c @@ -0,0 +1,7 @@ +void baz(int i); + +void foo(int i, int A[i+1]) +{ + int j=A[i]; + void bar() { baz(A[i]); } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030725-1.c b/gcc/testsuite/gcc.c-torture/compile/20030725-1.c new file mode 100644 index 000000000..26f271401 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030725-1.c @@ -0,0 +1,9 @@ +/* This testcase caused ICE on any 64-bit arch at -O2/-O3 due to + fold/extract_muldiv/convert destroying its argument. */ +int x, *y, z, *p; + +void +foo (void) +{ + p = y + (8 * (x == 1 || x == 3) + z); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030804-1.c b/gcc/testsuite/gcc.c-torture/compile/20030804-1.c new file mode 100644 index 000000000..189fde3ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030804-1.c @@ -0,0 +1,9 @@ +/* Extracted from PR middle-end/11771. */ +/* The following testcase used to ICE without -ffast-math from unbounded + recursion in fold. This was due to the logic in negate_expr_p not + matching that in negate_expr. */ + +double f(double x) { + return -(1 - x) + (x ? -(1 - x) : 0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030821-1.c b/gcc/testsuite/gcc.c-torture/compile/20030821-1.c new file mode 100644 index 000000000..34700ae18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030821-1.c @@ -0,0 +1,24 @@ +/* PR target/11805. */ + +/* Consider the following sequence. + + (set (cc0) + (and:HI (reg:HI 0) + (const_int 1))) + + (set (pc) + (if_then_else (le (cc0) + (const_int 0)) + (label_ref 17) + (pc))) + + On h8300, the first insn does not set the overflow flag, but the + second requires the overflow flag. As a result, when the final + wants to output the jump insn, it cannot find a test insn that + gives appropriate condition flags. */ + +unsigned char +foo (unsigned char a) +{ + return (a & 1) > 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030823-1.c b/gcc/testsuite/gcc.c-torture/compile/20030823-1.c new file mode 100644 index 000000000..89a3ea50a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030823-1.c @@ -0,0 +1,18 @@ +struct A +{ + int a; +}; + +int foo (struct A *a) +{ + static int c = 30; + int x; + + a->a = c; + /* Dominator optimizations will replace the use of 'a->a' with 'c', but + they won't copy the virtual operands for 'c' from its originating + statement. This exposes symbol 'c' without a correct SSA version + number. */ + x = a->a; + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030902-1.c b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c new file mode 100644 index 000000000..56c2650b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c @@ -0,0 +1,37 @@ +typedef __SIZE_TYPE__ size_t; +typedef unsigned long int reg_syntax_t; +struct re_pattern_buffer +{ + unsigned char *buffer; +}; +typedef enum +{ + jump, + jump_n, +} re_opcode_t; +static int +foo (bufp) + struct re_pattern_buffer *bufp; +{ + int mcnt; + unsigned char *p = bufp->buffer; + switch (((re_opcode_t) * p++)) + { + unconditional_jump: + ; + /* This test case caused an ICE because the statement insertion + routines were failing to update basic block boundaries. */ + case jump: + do + { + (mcnt) = *(p) & 0377; + } + while (0); + (p) += 2; + p += mcnt; + case jump_n: + (mcnt) = *(p + 2) & 0377; + if (mcnt) + goto unconditional_jump; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030903-1.c b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c new file mode 100644 index 000000000..fa4d30db6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c @@ -0,0 +1,33 @@ +/* Derived from PR optimization/11700. */ +/* The compiler used to ICE during reload for m68k targets. */ + +void check_complex (__complex__ double, __complex__ double, + __complex__ double, __complex__ int); +void check_float (double, double, double, int); +extern double _Complex conj (double _Complex); +extern double carg (double _Complex __z); + +static double minus_zero; + +void +conj_test (void) +{ + check_complex (conj (({ __complex__ double __retval; + __real__ __retval = (0.0); + __imag__ __retval = (0.0); + __retval; })), + ({ __complex__ double __retval; + __real__ __retval = (0.0); + __imag__ __retval = (minus_zero); + __retval; }), 0, 0); +} + +void +carg_test (void) +{ + check_float (carg (({ __complex__ double __retval; + __real__ __retval = (2.0); + __imag__ __retval = (0); + __retval; })), 0, 0, 0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030904-1.c b/gcc/testsuite/gcc.c-torture/compile/20030904-1.c new file mode 100644 index 000000000..09fd015b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030904-1.c @@ -0,0 +1,94 @@ +struct A +{ + long a1; + double *a2; +}; + +struct B +{ + void *b1; + double b2, b3; + struct + { + int d1; + double d2; + } b4; +}; + +struct C +{ + struct A *c1; + void *c2; +}; + +long fn1 (struct A *, double); +void fn2 (void *, const char *); +double fn3 (double); +double fn4 (double); +int fn5 (void *, double, double); + +int +foo (struct B *x) +{ + struct C *e = x->b1; + struct A *f = e->c1; + long g, h, i; + double *j, k; + g = fn1 (f, 0.5 * (x->b2 + x->b3)), h = g + 1, i = f->a1; + j = f->a2, k = x->b4.d2; + fn2 (x, "something"); + if (g <= 0) + { + double l = j[2] - j[1]; + if (l > 0.0 && l <= 0.02) + k = (x->b4.d1 == 1 + ? ((1.0 / l) < 25 ? 25 : (1.0 / l)) + : fn3 ((1.0 / l) < 25 ? 25 : (1.0 / l))); + } + else + { + double m = j[h] - j[g], n = 0.0, l = 0.0; + if (g > 1) + n = j[g] - j[g - 1]; + if (h < i) + l = j[h + 1] - j[h]; + if (n > 0.02) + n = 0; + if (m > 0.02) + m = 0; + if (l > 0.02) + l = 0; + if (m < n) + { + double o = m; + m = n; + n = o; + } + if (l < n) + { + double o = l; + l = n; + n = o; + } + if (l < m) + { + double o = l; + l = m; + m = o; + } + if (n != 0.0) + k = (x->b4.d1 == 1 + ? ((1 / m) < 25 ? 25 : (1 / m)) + : fn3 ((1 / m) < 25 ? 25 : (1 / m))); + else if (m != 0.0) + k = (x->b4.d1 == 1 + ? ((2 / (m + l)) < 25 ? 25 : (2 / (m + l))) + : fn3 ((2 / (m + l)) < 25 ? 25 : (2 / (m + l)))); + else if (l != 0.0) + k = (x->b4.d1 == 1 + ? ((1 / l) < 25 ? 25 : (1 / l)) + : fn3 ((1 / l) < 25 ? 25 : (1 / l))); + } + fn5 (e->c2, 0.5 * (x->b2 + x->b3), (x->b4.d1 == 1 ? k : fn4 (k))); + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030907-1.c b/gcc/testsuite/gcc.c-torture/compile/20030907-1.c new file mode 100644 index 000000000..e362b9102 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030907-1.c @@ -0,0 +1,25 @@ +/* PR 11665 + Orgin: jwhite@cse.unl.edu + The problem was in initializer_constant_valid_p, + "for a CONSTRUCTOR, only the last element + of the CONSTRUCTOR was being checked" + (from the email of the patch which fixed this). + This used to ICE because GCC thought gdt_table was a + constant value when it is not. */ + +int x; +struct gdt +{ +unsigned a,b,c,d,e,f; +}; +void f() +{ +struct gdt gdt_table[2]= +{ + { + 0, + ( (((unsigned)(&x))<<(24))&(-1<<(8)) ), + }, +}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030910-1.c b/gcc/testsuite/gcc.c-torture/compile/20030910-1.c new file mode 100644 index 000000000..9fad10920 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030910-1.c @@ -0,0 +1,11 @@ +/* The gimplifier was getting confused when taking the real or + imaginary component of a complex rvalue. */ + +void test() +{ + __complex double dc; + double d; + + d = __real (dc * dc); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030917-1.c b/gcc/testsuite/gcc.c-torture/compile/20030917-1.c new file mode 100644 index 000000000..38b6598af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030917-1.c @@ -0,0 +1,18 @@ +typedef struct string STR; +typedef struct atbl ARRAY; +struct string { + unsigned char str_pok; +}; +struct atbl { + int ary_fill; +}; +blah(size,strp) +register int size; +register STR **strp; +{ + register ARRAY *ar; + ar->ary_fill = size - 1; + while (size--) + (*strp)->str_pok &= ~128; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030921-1.c b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c new file mode 100644 index 000000000..8199dc657 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c @@ -0,0 +1,10 @@ +/* PR 12281 The darwin back-end was causing the function + f is not being emitted. TREE_SYMBOL_REFERENCED was being set + instead of calling mark_referenced. */ + + +static void f(void); +void g(void (*x) (void)){x();} +static inline void f(void){} +void h(){g(f);} +int main(){h();return 0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031002-1.c b/gcc/testsuite/gcc.c-torture/compile/20031002-1.c new file mode 100644 index 000000000..a023994f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031002-1.c @@ -0,0 +1,9 @@ +/* PR/12292 + http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00143.html */ + +char flags; + +int bug12292(int t) +{ + flags &= ~(1 << (t + 4)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031010-1.c b/gcc/testsuite/gcc.c-torture/compile/20031010-1.c new file mode 100644 index 000000000..33c71c6d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031010-1.c @@ -0,0 +1,4 @@ +/* This crashed the ARM backend with -mcpu=iwmmxt -O because an insn + required a split which was not available for the iwmmxt. */ +inline int *f1(int* a, int* b) { if (*b < *a) return b; return a; } +int f2(char *d, char *e, int f) { int g = e - d; return *f1(&f, &g); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20031011-1.c b/gcc/testsuite/gcc.c-torture/compile/20031011-1.c new file mode 100644 index 000000000..e35d76211 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031011-1.c @@ -0,0 +1,21 @@ +/* PR optimization/12544 */ +/* Origin: Tony Hosking <hosking@cs.purdue.edu> */ + +/* Verify that non-local structures passed by invisible + reference are correctly put in the stack. */ + +typedef struct { + int a; + int f; +} A; + +A *b; + +void x (A a) { + void y () { + a.a = 0; + } + + b = &a; + y(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031011-2.c b/gcc/testsuite/gcc.c-torture/compile/20031011-2.c new file mode 100644 index 000000000..026845509 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031011-2.c @@ -0,0 +1,15 @@ +/* PR optimization/12260. */ + +extern int f(void); +extern int g(int); + +static char buf[512]; +void h(int l) { + while (l) { + char *op = buf; + if (f() == 0) + break; + if (g(op - buf + 1)) + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-1.c b/gcc/testsuite/gcc.c-torture/compile/20031023-1.c new file mode 100644 index 000000000..67f8ea918 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-1.c @@ -0,0 +1,66 @@ +#ifndef ASIZE +# define ASIZE 0x10000000000UL +#endif + +#include <limits.h> + +#if LONG_MAX < 8 * ASIZE +# undef ASIZE +# define ASIZE 4096 +#endif + +extern void abort (void); + +int __attribute__((noinline)) +foo (const char *s) +{ + if (!s) + return 1; + if (s[0] != 'a') + abort (); + s += ASIZE - 1; + if (s[0] != 'b') + abort (); + return 0; +} + +int (*fn) (const char *) = foo; + +int __attribute__((noinline)) +bar (void) +{ + char s[ASIZE]; + s[0] = 'a'; + s[ASIZE - 1] = 'b'; + foo (s); + foo (s); + return 0; +} + +int __attribute__((noinline)) +baz (long i) +{ + if (i) + return fn (0); + else + { + char s[ASIZE]; + s[0] = 'a'; + s[ASIZE - 1] = 'b'; + foo (s); + foo (s); + return fn (0); + } +} + +int +main (void) +{ + if (bar ()) + abort (); + if (baz (0) != 1) + abort (); + if (baz (1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-2.c b/gcc/testsuite/gcc.c-torture/compile/20031023-2.c new file mode 100644 index 000000000..663e44715 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-2.c @@ -0,0 +1,2 @@ +#define ASIZE 0x1000000000UL +#include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-3.c b/gcc/testsuite/gcc.c-torture/compile/20031023-3.c new file mode 100644 index 000000000..f4a16c73c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-3.c @@ -0,0 +1,2 @@ +#define ASIZE 0x100000000UL +#include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-4.c b/gcc/testsuite/gcc.c-torture/compile/20031023-4.c new file mode 100644 index 000000000..5c61f3743 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-4.c @@ -0,0 +1,2 @@ +#define ASIZE 0x80000000UL +#include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/20031031-1.c b/gcc/testsuite/gcc.c-torture/compile/20031031-1.c new file mode 100644 index 000000000..e641b78a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031031-1.c @@ -0,0 +1,36 @@ +/* PR/11640 */ + +int +internal_insn_latency (int insn_code, int insn2_code) +{ + switch (insn_code) + { + case 256: + switch (insn2_code) + { + case 267: + return 8; + case 266: + return 8; + case 265: + return 8; + case 264: + return 8; + case 263: + return 8; + } + break; + case 273: + switch (insn2_code) + { + case 267: + return 5; + case 266: + return 5; + case 277: + return 3; + } + break; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031031-2.c b/gcc/testsuite/gcc.c-torture/compile/20031031-2.c new file mode 100644 index 000000000..d69dc75ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031031-2.c @@ -0,0 +1,36 @@ +/* PR/10239 */ + +enum node_type +{ + INITIAL = 0, FREE, + PRECOLORED, + SIMPLIFY, SIMPLIFY_SPILL, SIMPLIFY_FAT, FREEZE, SPILL, + SELECT, + SPILLED, COALESCED, COLORED, + LAST_NODE_TYPE +}; + +inline void +put_web (enum node_type type) +{ + switch (type) + { + case INITIAL: + case FREE: + case FREEZE: + case SPILL: + foo (); + break; + case PRECOLORED: + bar (); + break; + default: + baz (); + } +} + +void +reset_lists () +{ + put_web (INITIAL); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031102-1.c b/gcc/testsuite/gcc.c-torture/compile/20031102-1.c new file mode 100644 index 000000000..e32b8bd86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031102-1.c @@ -0,0 +1,12 @@ +/* PR optimization/10817. + Check that the following code doesn't cause any problems + for GCC's if-conversion passes. */ + +int foo(int t) +{ + int result = 0; + if (t != 0) + result = t; + return result; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031112-1.c b/gcc/testsuite/gcc.c-torture/compile/20031112-1.c new file mode 100644 index 000000000..466b29edf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031112-1.c @@ -0,0 +1,2 @@ +extern __inline int __finite (double __value) { return 0; } +extern __typeof (__finite) __finite __asm__ ("" "__GI___finite"); diff --git a/gcc/testsuite/gcc.c-torture/compile/20031113-1.c b/gcc/testsuite/gcc.c-torture/compile/20031113-1.c new file mode 100644 index 000000000..74c031c3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031113-1.c @@ -0,0 +1,21 @@ +/* On Darwin, the stub for simple_cst_equal was not being emitted at all + causing the as to die and not create an object file. */ + +int +attribute_list_contained () +{ + return (simple_cst_equal ()); +} +int +simple_cst_list_equal () +{ + return (simple_cst_equal ()); +} + + +int __attribute__((noinline)) +simple_cst_equal () +{ + return simple_cst_list_equal (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031124-1.c b/gcc/testsuite/gcc.c-torture/compile/20031124-1.c new file mode 100644 index 000000000..102e71aa8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031124-1.c @@ -0,0 +1,8 @@ +/* PR 13143 */ + +int f (void *ptr) +{ + extern char const stop[]; + return ptr >= (void *) &stop; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031125-1.c b/gcc/testsuite/gcc.c-torture/compile/20031125-1.c new file mode 100644 index 000000000..d3e92679c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031125-1.c @@ -0,0 +1,34 @@ +short *_offsetTable; +/* This tests to make sure PRE splits the entry block ->block 0 edge + when there are multiple block 0 predecessors. + This is done so that we don't end up with an insertion on the + entry block -> block 0 edge which would require a split at insertion + time. + PR 13163. */ +void proc4WithoutFDFE(char *dst, const char *src, int next_offs, int bw, + int bh, int pitch) +{ + do { + int i = bw; + int code = *src++; + int x, l; + int length = *src++ + 1; + + for (l = 0; l < length; l++) { + int x; + + for (x = 0; x < 4; x++) ; + if (i == 0) + dst += pitch * 3; + } + char *dst2 = dst + _offsetTable[code] + next_offs; + + for (x = 0; x < 4; x++) { + int j = 0; + (dst + pitch * x)[j] = (dst2 + pitch * x)[j]; + } + dst += pitch * 3; + } while (--bh); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031125-2.c b/gcc/testsuite/gcc.c-torture/compile/20031125-2.c new file mode 100644 index 000000000..42b72480e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031125-2.c @@ -0,0 +1,18 @@ +struct BlobSpan { + int right; +}; +/* This test makes sure we don't accidently cause a bad insertion to occur + by choosing the wrong variable name so that we end up with a use not + dominated by a def. */ +void render_blob_line(struct BlobSpan blobdata) { + int buf[4 * 8]; + int *data = buf; + int i, n = 0; + if (blobdata.right) + n++; + if (n) + for (; i < 2 * n;) + data[i] = 0; + n *= 2; + for (; n;) ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-1.c b/gcc/testsuite/gcc.c-torture/compile/20031203-1.c new file mode 100644 index 000000000..70547fdfe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031203-1.c @@ -0,0 +1,20 @@ +void make_file_symbol_completion_list (char *); +/* This tests to make sure PRE doesn't choose the wrong name when + inserting phi nodes. Otherwise, we get uses that aren't dominated + by defs. + PR 13177. */ +void location_completer (char *text) +{ + char *p, *symbol_start = text; + for (p = text; *p != '\0'; ++p) { + if (*p == '\\' && p[1] == '\'') + p++; + else if (*p == ':') + symbol_start = p + 1; + else + symbol_start = p + 1; + make_file_symbol_completion_list(symbol_start); + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-2.c b/gcc/testsuite/gcc.c-torture/compile/20031203-2.c new file mode 100644 index 000000000..47f561bae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031203-2.c @@ -0,0 +1,6 @@ +/* Don't ICE on stupid user tricks. */ + +int foo(int bar) +{ + return (&bar)[-1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-3.c b/gcc/testsuite/gcc.c-torture/compile/20031203-3.c new file mode 100644 index 000000000..341a9df98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031203-3.c @@ -0,0 +1,7 @@ +/* Don't ICE on user silliness. GCC 3.4 and before accepts this without + comment; 3.5 warns. Perhaps eventually we'll declare this an error. */ + +void bar (void) +{ + ({}); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031208-1.c b/gcc/testsuite/gcc.c-torture/compile/20031208-1.c new file mode 100644 index 000000000..02586dfe1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031208-1.c @@ -0,0 +1,6 @@ +extern int foo(int, ...); +int bar(void) { + long double l = 1.2345E6; + foo(0, l); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031220-1.c b/gcc/testsuite/gcc.c-torture/compile/20031220-1.c new file mode 100644 index 000000000..026a2687f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031220-1.c @@ -0,0 +1,21 @@ +/* PR optimization/13031 */ +/* The following code used to ICE on alphaev67-*-* at -O2 with an + unrecognizable instruction, caused by local register allocation + substituting a register for a constant in a conditional branch. */ + +void emit(int, int); +int f(void); +static int signals[5]; + +static inline void select(int sel, void *klass) +{ + emit(klass ? 0 : f(), signals[sel ? 0 : 1]); +} + +void all(void *gil, void *l, void *icon) +{ + while (l) + if (icon) + select(0, gil); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031220-2.c b/gcc/testsuite/gcc.c-torture/compile/20031220-2.c new file mode 100644 index 000000000..45c827794 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031220-2.c @@ -0,0 +1,44 @@ +/* PR target/12749 + Orgin: Matt Thomas <matt@3am-software.com> + This used to cause GCC to write out an instruction for i386 when using a L64 host + which gas could not handle because GCC would write a full 64bit hex string out. */ + + +float fabsf (float); +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef union +{ + float value; + __uint32_t word; +} ieee_float_shape_type; +extern float __ieee754_expf (float); +extern float __ieee754_sinhf (float); +static const float one = 1.0, shuge = 1.0e37; +float +__ieee754_sinhf(float x) +{ + float t,w,h; + __int32_t ix,jx; + do { ieee_float_shape_type gf_u; gf_u.value = (x); (jx) = gf_u.word; } while (0); + ix = jx&0x7fffffff; + if(ix>=0x7f800000) return x+x; + h = 0.5; + if (jx<0) h = -h; + if (ix < 0x41b00000) { + if (ix<0x31800000) + if(shuge+x>one) return x; + t = expm1f(fabsf(x)); + if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one)); + return h*(t+t/(t+one)); + } + if (ix < 0x42b17180) return h*__ieee754_expf(fabsf(x)); + if (ix<=0x42b2d4fc) { + w = __ieee754_expf((float)0.5*fabsf(x)); + t = h*w; + return t*w; + } + return x*shuge; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031227-1.c b/gcc/testsuite/gcc.c-torture/compile/20031227-1.c new file mode 100644 index 000000000..41597bd18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031227-1.c @@ -0,0 +1,17 @@ +/* PR opt/13159 -- test unswitching a loop multiple times. */ + +void +foo (void) +{ + long j, k, p, g; + + while (p) + { + while (k < 0 && j < 0) + ; + if (g) + ; + else if (g) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031231-1.c b/gcc/testsuite/gcc.c-torture/compile/20031231-1.c new file mode 100644 index 000000000..bbd8e7cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031231-1.c @@ -0,0 +1,51 @@ +extern int f1 (int, void *); +extern int *f2 (void) __attribute__ ((__const__)); +extern int f3 (int, void *); + +int +test (int x, char *y, int z) +{ + int b = 0; + + if (x < 1024) + { + y[0] = '\0'; + + do + { + switch (f1 (x, y + b)) + { + case -1: + if (b == 0) + return -1; + else + return b; + + default: + b++; + } + } + while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z); + } + else + { + do + { + switch (f3 (x, y + b)) + { + case -1: + if ((*f2 ()) == 4) + continue; + if (b == 0) + return -1; + else + return b; + + default: + b++; + } + } + while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z); + } + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040101-1.c b/gcc/testsuite/gcc.c-torture/compile/20040101-1.c new file mode 100644 index 000000000..baa0e4f93 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040101-1.c @@ -0,0 +1,30 @@ +/* { dg-skip-if "not enough registers" { pdp11-*-* } { "-O[12s]" } { "" } } */ + +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +#define CF (1<<0) +#define PF (1<<2) +#define AF (1<<4) +#define ZF (1<<6) +#define SF (1<<7) +#define OF (1<<11) + +#define EFLAGS_BITS (CF|PF|AF|ZF|SF|OF) + +void test16(uint16_t x, uint32_t eflags) +{ + uint16_t bsr_result; + uint32_t bsr_eflags; + uint16_t bsf_result; + uint32_t bsf_eflags; + + __asm volatile("" + : "=&r" (bsr_result), "=&r" (bsr_eflags) + : "r" (x), "i" (~EFLAGS_BITS), "r" (eflags)); + __asm volatile("" + : "=&r" (bsf_result), "=&r" (bsf_eflags) + : "r" (x), "i" (~EFLAGS_BITS), "r" (eflags)); + printf("%08x %04x bsrw %02x %08x bsfw %02x %08x\n", + x, eflags, bsr_result, bsr_eflags, bsf_result, bsf_eflags); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040109-1.c b/gcc/testsuite/gcc.c-torture/compile/20040109-1.c new file mode 100644 index 000000000..028bd17c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040109-1.c @@ -0,0 +1,25 @@ +/* PR target/13380. + On m32r, the condition code register, (reg:SI 17), was replaced with + a pseudo reg, which would cause an unrecognized insn. */ + +void +foo (unsigned int a, unsigned int b) +{ + if (a > b) + { + while (a) + { + switch (b) + { + default: + a = 0; + case 2: + a = 0; + case 1: + a = 0; + case 0: + ; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040121-1.c b/gcc/testsuite/gcc.c-torture/compile/20040121-1.c new file mode 100644 index 000000000..2039472fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040121-1.c @@ -0,0 +1,41 @@ +/* PR target/12898 + 0x8000 needs multiple instructions to be emitted on Alpha; the + fluff around it causes it to be emitted in a no_new_pseudos + context, which triggered a problem in alpha.c. */ + +void f (const char *, ...); +int g (void); +void *p (void); + +int isymBase, ilineBase, sym_hdr, want_line, proc_desc; +char *lines; + +void print_file_desc (int *fdp) +{ + char *str_base = p (); + int symi, pdi = g (); + + for (symi = 0; isymBase;) + { + int proc_ptr = proc_desc + pdi; + f("1", isymBase, proc_ptr + *fdp, str_base); + if (want_line && *fdp) + { + int delta; + long cur_line = proc_ptr; + char *line_ptr = lines + proc_ptr; + char *line_end = p (); + + f("2", sym_hdr); + while (line_ptr < line_end) + { + delta = *line_ptr; + if (delta) + line_ptr++; + else + delta = line_ptr[1] ^ 0x8000; + f("3", cur_line, delta); + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040124-1.c b/gcc/testsuite/gcc.c-torture/compile/20040124-1.c new file mode 100644 index 000000000..01c900238 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040124-1.c @@ -0,0 +1,22 @@ +int +f1 (int a, int b) +{ + int i, j, k; + + switch (b) + { + case (-9): + j = 4; + break; + case (-10): + j = 10; + break; + case (-8): + j = 15; + break; + } + + i = f2 (f3 (b == (-9) ? k : a), j); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040130-1.c b/gcc/testsuite/gcc.c-torture/compile/20040130-1.c new file mode 100644 index 000000000..e661c176a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040130-1.c @@ -0,0 +1,28 @@ +/* PR target/11475 */ +/* Origin: <heinrich.brand@fujitsu-siemens.com> */ + +/* This used to fail on SPARC because of a broken pattern. */ + +#pragma pack(2) + +struct +{ + unsigned char G936:7; + unsigned short G937:6; + unsigned int :4; + unsigned short :14; + unsigned int G938:8; +#if __INT_MAX__ >= 2147483647L + unsigned int :30; +#endif + unsigned short :16; +#if __INT_MAX__ >= 2147483647L + unsigned int :18; +#endif + unsigned short G939:9; +} G928b; + +void TestG928(void) +{ + G928b.G936 |= G928b.G939; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040202-1.c b/gcc/testsuite/gcc.c-torture/compile/20040202-1.c new file mode 100644 index 000000000..ba32c8049 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040202-1.c @@ -0,0 +1,8 @@ +/* PR target/13789 */ +/* Failed on SPARC due to a bug in store_expr. */ + +void *foo (void *c) +{ + void *a = __builtin_extract_return_addr (c); + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040209-1.c b/gcc/testsuite/gcc.c-torture/compile/20040209-1.c new file mode 100644 index 000000000..d256d58e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040209-1.c @@ -0,0 +1,9 @@ +/* The following code used to ICE in fold_convert. */ + +float ceilf(float); + +int foo(float x) +{ + return (double)ceilf(x); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040214-1.c b/gcc/testsuite/gcc.c-torture/compile/20040214-1.c new file mode 100644 index 000000000..90b09dcdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040214-1.c @@ -0,0 +1,7 @@ +void foo(void) +{ + char c; + + for (c = -75; c <= 75; c++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040214-2.c b/gcc/testsuite/gcc.c-torture/compile/20040214-2.c new file mode 100644 index 000000000..352d5a5d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040214-2.c @@ -0,0 +1,57 @@ +/* http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01307.html */ + +typedef struct xdef xdef; +struct xdef +{ + char xtyp; + xdef *next; + int y; +}; + +extern void b (); +extern void *foo (void *bar); +extern void *foo2 (void *bar1, void *bar2); +extern void *qwe; + +static void +c (xdef * xp) +{ + b (xp); +} +static void +a (xdef ** xpp) +{ + xdef *xp; + xp = *xpp; + + foo (xp); + xp = foo2 (xp, qwe); + b (xp->next); + foo (xp); + if (xp->y) + { + foo (xp); + if (xp) + { + xdef *p = foo2 (xp, qwe); + foo2 (xp, p); + xp = foo (p); + } + else + { + foo2 (foo(*xpp), *xpp); + } + } + *xpp = foo2 (xpp, qwe); +} + +void +b (xdef ** xpp) +{ + xdef *xp = *xpp; + if (!xp) + return; + if (xp->xtyp == 0) + a (xpp); + c (xp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040216-1.c b/gcc/testsuite/gcc.c-torture/compile/20040216-1.c new file mode 100644 index 000000000..12d5e5ea7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040216-1.c @@ -0,0 +1,4 @@ +int foo (int a, int b, int c, int d) +{ + return ~a & ~b & ~c & ~d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040219-1.c b/gcc/testsuite/gcc.c-torture/compile/20040219-1.c new file mode 100644 index 000000000..d3bc9272b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040219-1.c @@ -0,0 +1 @@ +double foo() { return __builtin_isgreater(0.,0.); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040220-1.c b/gcc/testsuite/gcc.c-torture/compile/20040220-1.c new file mode 100644 index 000000000..8a4a5ba6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040220-1.c @@ -0,0 +1,16 @@ +/* PR 14194 */ + +int irqs; + +static inline __attribute__((always_inline)) +int kstat_irqs (void) { + int i, sum = 0; + for (i = 0; i < 1; i++) + if (__builtin_expect(i, 0)) + sum += irqs; + return sum; +} + +int show_interrupts (void) { + return kstat_irqs (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040303-1.c b/gcc/testsuite/gcc.c-torture/compile/20040303-1.c new file mode 100644 index 000000000..6b2452ada --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040303-1.c @@ -0,0 +1,16 @@ +typedef struct input { + struct input *next; +} input_t; +static input_t *inputs = (input_t *)((void *)0); +void +RemoveInput(unsigned long id) +{ + input_t *ip; + input_t *prev; + while (1) + if (ip == (input_t *)id) + break; + if (ip == (input_t *)((void *)0)) + return; + prev->next = ip->next; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040303-2.c b/gcc/testsuite/gcc.c-torture/compile/20040303-2.c new file mode 100644 index 000000000..6751620a4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040303-2.c @@ -0,0 +1,23 @@ +void abort(void); +int x, y; +void init_xy(void); +void +test4(void) +{ + init_xy(); + _Bool iftemp0; + int x1 = x; + _Bool iftemp1; + x1++; + if (x1 != 3) + { + iftemp1 = 1; + goto endfirstif; + } + iftemp1 = 0; + endfirstif: + iftemp0 = iftemp1; + if (iftemp0) + abort(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040304-1.c b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c new file mode 100644 index 000000000..ee277d799 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c @@ -0,0 +1,20 @@ +void +cpplib_macroExpand (char * pfile) +{ + int nargs; + int rest_args; + int token = -1; + rest_args = 0; + do + { + if (rest_args != 0) + continue; + if (nargs == 0) + { + rest_args = 1; + token = macarg (pfile, rest_args); + } + } + while (token == 20); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040309-1.c b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c new file mode 100644 index 000000000..df8390f20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c @@ -0,0 +1,20 @@ +static const char default_tupleseps[] = ", \t"; + + +fubar (tupleseps) + const char *tupleseps; +{ + char *kp, *sp; + const char *septmp; + const char *tseplist; + tseplist = (tupleseps) ? tupleseps : default_tupleseps; + while (kp) + { + if (*tseplist) + septmp = tseplist; + bar (*septmp); + if (*tseplist) + if (*kp) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040310-1.c b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c new file mode 100644 index 000000000..f0c85f0ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c @@ -0,0 +1,10 @@ +void I_wacom () +{ + char buffer[50], *p; + int RequestData (char *cmd) + { + p = buffer; + foo (buffer); + } + RequestData (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-1.c b/gcc/testsuite/gcc.c-torture/compile/20040317-1.c new file mode 100644 index 000000000..4a3455115 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040317-1.c @@ -0,0 +1,4 @@ +int String2Array(int len, char strarr[][len]) +{ + strarr[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-2.c b/gcc/testsuite/gcc.c-torture/compile/20040317-2.c new file mode 100644 index 000000000..3c8ee2b8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040317-2.c @@ -0,0 +1,25 @@ +typedef struct _ScaleRec *ScaleWidget; +typedef struct +{ + short *x; + unsigned short *width; +} Table; +typedef struct +{ + Table table; +} ScalePart; +typedef struct _ScaleRec +{ + ScalePart scale; +} ScaleRec; +static int +FindPixel (ScaleWidget sw, short x, short y, + short * img_x, short * img_y, unsigned long * img_pixel) +{ + if (sw->scale.table.x[(int) *img_x] + + (short) sw->scale.table.width[(int) *img_x] < x) + { + ++*img_x; + return FindPixel (sw, x, y, img_x, img_y, img_pixel); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-3.c b/gcc/testsuite/gcc.c-torture/compile/20040317-3.c new file mode 100644 index 000000000..e6982c3e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040317-3.c @@ -0,0 +1,11 @@ +I_wacom () +{ + char buffer[50], *p; + int RequestData (char *cmd) + { + p = buffer; + foo (buffer); + } + RequestData (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040323-1.c b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c new file mode 100644 index 000000000..77ddadc9d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c @@ -0,0 +1,12 @@ +/* PR middle-end/14694 */ +/* { dg-require-alias "" } */ + +unsigned int _rtld_global = 1; +extern unsigned int _rtld_local __attribute__ ((alias ("_rtld_global"))); + +unsigned int +_dl_start (void *arg) +{ + unsigned int elf_machine_rel () { return _rtld_local; } + return elf_machine_rel (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040401-1.c b/gcc/testsuite/gcc.c-torture/compile/20040401-1.c new file mode 100644 index 000000000..ee727a9b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040401-1.c @@ -0,0 +1,6 @@ +int __atomic_readv_replacement(unsigned char iov_len, int count, int i) { + unsigned char bytes = 0; + if ((unsigned char)((char)127 - bytes) < iov_len) + return 22; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040415-1.c b/gcc/testsuite/gcc.c-torture/compile/20040415-1.c new file mode 100644 index 000000000..1b1537a7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040415-1.c @@ -0,0 +1,5 @@ +int isdigit (int); +int f (const char *type) +{ + return isdigit ((unsigned char) *type++); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040415-2.c b/gcc/testsuite/gcc.c-torture/compile/20040415-2.c new file mode 100644 index 000000000..e78e81e8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040415-2.c @@ -0,0 +1,7 @@ +int isascii (int); + +int f1 (const char *type) +{ + return isascii ((unsigned char) *type++); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040419-1.c b/gcc/testsuite/gcc.c-torture/compile/20040419-1.c new file mode 100644 index 000000000..76910455f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040419-1.c @@ -0,0 +1,3 @@ +/* This used to ICE because PHI-OPT would produce non-gimple code. */ + +int f(double d0, double d1) { return d0 > 0 == d1 > 0; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040602-1.c b/gcc/testsuite/gcc.c-torture/compile/20040602-1.c new file mode 100644 index 000000000..8f751e362 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040602-1.c @@ -0,0 +1,5 @@ +/* Test type qualifiers. These should as equal types. */ +extern volatile unsigned long foo; +typedef unsigned long ulong; +extern volatile ulong foo; +volatile ulong foo; diff --git a/gcc/testsuite/gcc.c-torture/compile/20040610-1.c b/gcc/testsuite/gcc.c-torture/compile/20040610-1.c new file mode 100644 index 000000000..37fb65ca2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040610-1.c @@ -0,0 +1,5 @@ +int foo (float x) +{ + float i = __builtin_inff (); + return x != i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040611-1.c b/gcc/testsuite/gcc.c-torture/compile/20040611-1.c new file mode 100644 index 000000000..8a5528b90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040611-1.c @@ -0,0 +1,8 @@ +/* This would cause PRE load motion to generate invalid code and ICE */ +void foo (char *name) +{ + if (*name) + name ++; + while (name[0]); + asm ("" : "=r" (name)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040614-1.c b/gcc/testsuite/gcc.c-torture/compile/20040614-1.c new file mode 100644 index 000000000..d99d27896 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040614-1.c @@ -0,0 +1,20 @@ +#ifndef NO_LABEL_VALUES +void f(int r1, int *fp) +{ + void *hlbl_tbl[] = { &&label1 }; + goto *hlbl_tbl[r1]; + *fp = 0; + label0: + fp += 8; + label1: + *fp = 0; + if (r1) + goto label2; + if (r1) + goto label0; + label2: + ; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20040621-1.c b/gcc/testsuite/gcc.c-torture/compile/20040621-1.c new file mode 100644 index 000000000..8a2ebb07e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040621-1.c @@ -0,0 +1,17 @@ +/* This test woudl cause partial redundancies too complex for PRE + to insert using a single temporary due to them not being GIMPLE + expressions. */ +int ssbgst (int c, int k) +{ + int a, i, j; + + a = 0; + i = 1; + j = k; + while (j) + { + a += (j + i) * (k + i + c) + (j + i + c); + j = j - 1; + } + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040624-1.c b/gcc/testsuite/gcc.c-torture/compile/20040624-1.c new file mode 100644 index 000000000..8eb92a4a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040624-1.c @@ -0,0 +1,3 @@ +struct s { float f[1]; }; +struct s foo(); +float bar() { return foo().f[0]; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040705-1.c b/gcc/testsuite/gcc.c-torture/compile/20040705-1.c new file mode 100644 index 000000000..1e45ee289 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040705-1.c @@ -0,0 +1,2 @@ +extern char foo[], bar[]; +void f (void) { memcpy (foo, bar, 7); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040708-1.c b/gcc/testsuite/gcc.c-torture/compile/20040708-1.c new file mode 100644 index 000000000..4a553917e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040708-1.c @@ -0,0 +1,68 @@ +/* PR rtl-optimization/16199 */ +/* Origin: Olaf Klein <oklein@smallo.ruhr.de> */ + +typedef enum { + APR_LOCK_FCNTL, + APR_LOCK_FLOCK, + APR_LOCK_SYSVSEM, + APR_LOCK_PROC_PTHREAD, + APR_LOCK_POSIXSEM, + APR_LOCK_DEFAULT +} apr_lockmech_e; + +struct apr_proc_mutex_unix_lock_methods_t { + unsigned int flags; + const char *name; +}; + +typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t; + +extern const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_sysv_methods; + +struct apr_proc_mutex_t { + const apr_proc_mutex_unix_lock_methods_t *inter_meth; + int curr_locked; + char *fname; +}; + +typedef struct apr_proc_mutex_t apr_proc_mutex_t; + +extern const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_proc_pthread_methods; + +extern const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_fcntl_methods; + +static int proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech) +{ + switch (mech) { + case APR_LOCK_FCNTL: + new_mutex->inter_meth = &apr_proc_mutex_unix_fcntl_methods; + break; + case APR_LOCK_FLOCK: + return ((20000 + 50000) + 23); + break; + case APR_LOCK_SYSVSEM: + new_mutex->inter_meth = &apr_proc_mutex_unix_sysv_methods; + break; + case APR_LOCK_POSIXSEM: + return ((20000 + 50000) + 23); + break; + case APR_LOCK_PROC_PTHREAD: + new_mutex->inter_meth = &apr_proc_mutex_unix_proc_pthread_methods; + break; + case APR_LOCK_DEFAULT: + new_mutex->inter_meth = &apr_proc_mutex_unix_proc_pthread_methods; + break; + default: + return ((20000 + 50000) + 23); + } + return 0; +} + +const char* apr_proc_mutex_defname(void) +{ + apr_proc_mutex_t mutex; + + if (proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT) != 0) { + return "unknown"; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040709-1.c b/gcc/testsuite/gcc.c-torture/compile/20040709-1.c new file mode 100644 index 000000000..c8c9cc357 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040709-1.c @@ -0,0 +1,10 @@ +/* PR target/16364 */ +union foo { + long double ld; +} bar; + +double +sub (union foo baz) +{ + return baz.ld / 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040726-1.c b/gcc/testsuite/gcc.c-torture/compile/20040726-1.c new file mode 100644 index 000000000..e53ccd655 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040726-1.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/16643 */ +void foo (int a, int b, int c, int d, int e, int *f) +{ + if (a == 0) + if (b == 0) + if (c == 0) + if (d == 0) + { + *f = e; + return; + } + *f = e; + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040726-2.c b/gcc/testsuite/gcc.c-torture/compile/20040726-2.c new file mode 100644 index 000000000..ce60095fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040726-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* From a failure after the global ccp pass. */ +typedef struct +{ + char n[129]; +} A; + +const A C = { + 0, + 0 +}; + +extern const A *const B; + +void bar(const char *); + +void foo () +{ + bar (B->n); +} + +const A *const B = &C; diff --git a/gcc/testsuite/gcc.c-torture/compile/20040727-1.c b/gcc/testsuite/gcc.c-torture/compile/20040727-1.c new file mode 100644 index 000000000..a46abec1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040727-1.c @@ -0,0 +1,32 @@ +/* Extracted from boehm-gc/os_dep.c on Darwin. It caused an ICE when + trying to merge alias information from two pointers that had + different type memory tags. */ +typedef int thread_state_flavor_t; +typedef int exception_behavior_t; +typedef unsigned int exception_mask_t; +typedef unsigned int exception_handler_t; +typedef unsigned int mach_msg_type_number_t; +static struct { + mach_msg_type_number_t count; + exception_mask_t masks[16]; + exception_handler_t ports[16]; + thread_state_flavor_t flavors[16]; +} GC_old_exc_ports; + +typedef exception_handler_t *exception_handler_array_t; +typedef thread_state_flavor_t *exception_flavor_array_t; + + +int task_get_exception_ports +( + mach_msg_type_number_t *masksCnt, + exception_handler_array_t old_handlers, + exception_flavor_array_t old_flavors +); + +void GC_dirty_init() +{ + task_get_exception_ports(GC_old_exc_ports.masks, + GC_old_exc_ports.ports, + GC_old_exc_ports.flavors); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040730-1.c b/gcc/testsuite/gcc.c-torture/compile/20040730-1.c new file mode 100644 index 000000000..6f224e9a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040730-1.c @@ -0,0 +1,17 @@ +/* PR tree-opt/16827 + This used to ICE in tree-ssa-loop-im.c */ + +extern unsigned short dev_roles[]; +void super_1_sync(int *rdev2) +{ + int i; + int max_dev = 0; + + for (i =0;i<20;i++) + if (rdev2[i] > max_dev) + max_dev = rdev2[i]; + + for (i=0; i<max_dev;i++) + dev_roles[max_dev] = 0xfffe; + +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040817-1.c b/gcc/testsuite/gcc.c-torture/compile/20040817-1.c new file mode 100644 index 000000000..158596c8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040817-1.c @@ -0,0 +1,19 @@ +/* PR 17051: SRA failed to rename the VOPS properly. */ + +struct A +{ + char c, d; +}; + +void foo(struct A *p) +{ + struct A a = *p; + + if (p->c) + bar1(a); + else + { + if (p) bar2(a,a.c); + bar3(a.c); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040824-1.c b/gcc/testsuite/gcc.c-torture/compile/20040824-1.c new file mode 100644 index 000000000..7d81932f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040824-1.c @@ -0,0 +1,2 @@ +/* This caused an out-of-range address on the MIPS port. */ +void foo (char *x) { __builtin_prefetch (x + 0x8000); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040901-1.c b/gcc/testsuite/gcc.c-torture/compile/20040901-1.c new file mode 100644 index 000000000..68aaa74ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040901-1.c @@ -0,0 +1,2 @@ +typedef enum {a, b} __attribute__((__mode__(__QI__))) x; +x foo; diff --git a/gcc/testsuite/gcc.c-torture/compile/20040907-1.c b/gcc/testsuite/gcc.c-torture/compile/20040907-1.c new file mode 100644 index 000000000..d1dd6f22d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040907-1.c @@ -0,0 +1,13 @@ +void ProdWord_bla ( gtL, gtRes, lnL ) + int *gtL, *gtRes; + int lnL; +{ + while ( 1 < lnL ) + { + *gtRes++ = *gtL++; + --lnL; + } + if ( 0 < lnL ) + if ( gtL[0] == gtL[1] ) + *gtRes++ = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040908-1.c b/gcc/testsuite/gcc.c-torture/compile/20040908-1.c new file mode 100644 index 000000000..f52bf5ee0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040908-1.c @@ -0,0 +1,12 @@ +/* PR 17186 */ + +double foo() +{ + int i; + double d; + + if (i) + bar(); + else + if (d) return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040909-1.c b/gcc/testsuite/gcc.c-torture/compile/20040909-1.c new file mode 100644 index 000000000..8bbf90191 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040909-1.c @@ -0,0 +1,13 @@ +static __inline__ int +one_utf8_to_utf16 () { } + +static __inline__ unsigned char +conversion_loop (int (*const one_conversion)()) +{ +return one_conversion (); +} +static unsigned char +convert_utf8_utf16 () +{ + return conversion_loop (one_utf8_to_utf16); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040914-1.c b/gcc/testsuite/gcc.c-torture/compile/20040914-1.c new file mode 100644 index 000000000..824664c88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040914-1.c @@ -0,0 +1,39 @@ +extern int clobber_k (int *); +extern int barrier (void); +int t, u; + +int +process_second_stream(void) +{ + int k; + int i = 0, j = 0, result; + + clobber_k (&k); + + while(t) + ; + + while(!j) + { + while(!j) + { + barrier (); + if (t == 0) + break; + else if(t == 1) + t = 2; + else + { + if(t < 0) + j=1; + if(u < 0) + k = i++; + } + } + + if(!j && u) + j=1; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040916-1.c b/gcc/testsuite/gcc.c-torture/compile/20040916-1.c new file mode 100644 index 000000000..1a6a9f47f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040916-1.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/17512 + + We used to try to fold "(char) (X ^ Y)", where '^' is + TRUTH_XOR_EXPR into ((char) X ^ (char) Y), creating TRUTH_XOR_EXPR + with its operands being of type char, which is invalid. */ + +char +foo (int p) +{ + int q = p; + return (p != 0) == (p == q); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041005-1.c b/gcc/testsuite/gcc.c-torture/compile/20041005-1.c new file mode 100644 index 000000000..b0a65117e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041005-1.c @@ -0,0 +1,6 @@ +/* This wrongly caused duplicate definitions of x in the assembler + output. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ + +static int x = 1; +void f (void) { extern int x; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20041007-1.c b/gcc/testsuite/gcc.c-torture/compile/20041007-1.c new file mode 100644 index 000000000..ce524703d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041007-1.c @@ -0,0 +1,16 @@ +/* PR rtl-optimization/17027 */ +/* Origin: dbk <sfc@village.uunet.be> */ +/* Testcase by Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de> */ + +int bar(void); +void baz (void) __attribute__ ((noreturn)); /* noreturn is required */ + +void foo (void) +{ + while (bar ()) { + switch (1) { + default: + baz (); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041018-1.c b/gcc/testsuite/gcc.c-torture/compile/20041018-1.c new file mode 100644 index 000000000..3cc0c8f8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041018-1.c @@ -0,0 +1,18 @@ +void +foo (int y, int z, unsigned char **t, int **c, int *b) +{ + int i, j, k; + unsigned char a[2]; + + a[0] = 0; + a[1] = 0; + for (j = 0; j < z; j++) + for (i = 0; i < y; i++, a[0] += 3) + for (k = 0; k < 3; k++) + c[0][k] += 3 * b[k]; + for (i = 0; i < 3; i++) + if (t[0][i] + c[0][i] / a[0] <= 0) + t[0][i] = 0; + else + t[0][i] = t[0][i] + c[0][i] / a[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041026-1.c b/gcc/testsuite/gcc.c-torture/compile/20041026-1.c new file mode 100644 index 000000000..3d6ae8fcd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041026-1.c @@ -0,0 +1,5 @@ +int +foo (double x, long double y) +{ + return __builtin_isgreater (x, y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041119-1.c b/gcc/testsuite/gcc.c-torture/compile/20041119-1.c new file mode 100644 index 000000000..3e0e565f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041119-1.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/17825 */ +#ifdef __i386__ +register unsigned int reg __asm ("esi"); +#elif defined __x86_64__ +register unsigned int reg __asm ("r14"); +#else +unsigned int reg; +#endif + +struct S +{ + unsigned int h[8]; +} *b; +unsigned int c; +void foo (int); + +void +bar (void) +{ + unsigned int j, k, l, m; + + j = (reg & 0xffff) | ((b->h[2] & 0xffff) << 16); + k = c & 0xffff; + if (k == 0) + foo (0); + l = (j / k) & 0xffff; + m = (j % k) & 0xffff; + reg = (reg & 0xffff0000) | l; + b->h[2] = (b->h[2] & 0xffff0000) | m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041211-1.c b/gcc/testsuite/gcc.c-torture/compile/20041211-1.c new file mode 100644 index 000000000..5b9c1d069 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041211-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/16951 */ + +void dummy_use(const char *p); + +__inline void f(const char *const p) { + const char q; + dummy_use(p); + f(&q); +} + +void crash() { + f(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050105-1.c b/gcc/testsuite/gcc.c-torture/compile/20050105-1.c new file mode 100644 index 000000000..16d18f306 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050105-1.c @@ -0,0 +1,5 @@ +void bar (struct S *); +void foo (void *x) +{ + bar ((struct S *) x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050113-1.c b/gcc/testsuite/gcc.c-torture/compile/20050113-1.c new file mode 100644 index 000000000..6e36ed6fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050113-1.c @@ -0,0 +1,16 @@ +/* PR c/17297 */ + +typedef float V2SF __attribute__ ((vector_size (8))); + +int test0 (V2SF, V2SF); + +int +main (void) +{ + V2SF a = (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f}; + V2SF b = (V2SF) {567.345, 1984.0}; + int i; + + i = test0 (a, b); + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050119-1.c b/gcc/testsuite/gcc.c-torture/compile/20050119-1.c new file mode 100644 index 000000000..4f14ea434 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050119-1.c @@ -0,0 +1,25 @@ +void write_char(char); +int len(char*); +void f(char *a) +{ + int col = 0; + int i; + void wchar(char c) + { + if (c == '\t') + { + do { + wchar(' '); + } while ((col%8)!=0); + } + else + { + write_char (c); + col++; + } + } + for(i =0;i<len(a);i++) + { + wchar(*a); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050122-1.c b/gcc/testsuite/gcc.c-torture/compile/20050122-1.c new file mode 100644 index 000000000..a70907d90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050122-1.c @@ -0,0 +1,12 @@ +/* From PR 19484. */ +extern void foo (void) __attribute__((noreturn)); +int n; + +void +g (void) +{ + void (*f) (void) = foo; + if (n) + f (); + n = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050122-2.c b/gcc/testsuite/gcc.c-torture/compile/20050122-2.c new file mode 100644 index 000000000..1e297be8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050122-2.c @@ -0,0 +1,21 @@ +/* Related to PR 19484. */ +/* { dg-require-effective-target trampolines } */ + +extern void foo (void) __attribute__((noreturn)); +int n; + +void +g (void) +{ + __label__ lab; + void h (void) { if (n == 2) goto lab; } + void (*f1) (void) = foo; + void (*f2) (void) = h; + + f2 (); + if (n) + f1 (); + n = 1; + lab: + n++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050202-1.c b/gcc/testsuite/gcc.c-torture/compile/20050202-1.c new file mode 100644 index 000000000..b3f817645 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050202-1.c @@ -0,0 +1,10 @@ +/* From PR 19578. */ +extern void foo (void) __attribute__((noreturn)); + +void +g (void) +{ + void (*f) (void) = foo; + f (); + f (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050206-1.c b/gcc/testsuite/gcc.c-torture/compile/20050206-1.c new file mode 100644 index 000000000..5ea49a6b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050206-1.c @@ -0,0 +1,8 @@ +unsigned short foo (void) +{ + unsigned short u[1] = { 1 }; + u[0] = 0; + u[1] = 1; + u[2] = 2; + return u[0] + u[1] + u[2]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050210-1.c b/gcc/testsuite/gcc.c-torture/compile/20050210-1.c new file mode 100644 index 000000000..c9e332640 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050210-1.c @@ -0,0 +1,8 @@ +/* PR middle-end/19858 */ + +typedef __SIZE_TYPE__ size_t; +union U { int c; } foo; +int bar (void) +{ + return !(((size_t) &foo & 3) == 0 && !((size_t) &foo & 1)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050215-1.c b/gcc/testsuite/gcc.c-torture/compile/20050215-1.c new file mode 100644 index 000000000..e9717797a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050215-1.c @@ -0,0 +1,4 @@ +/* PR tree-optimization/18947 */ +extern __inline void f1 (void) { } +extern __inline void f2 (void) { f1 (); } +void f2 (void) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050215-2.c b/gcc/testsuite/gcc.c-torture/compile/20050215-2.c new file mode 100644 index 000000000..44550d04c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050215-2.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/18947 */ +int v; +extern __inline void f1 (void) { v++; } +void f4 (void) { f1 (); } +extern __inline void f2 (void) { f1 (); } +void f3 (void) { f2 (); } +void f2 (void) { f1 (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20050215-3.c b/gcc/testsuite/gcc.c-torture/compile/20050215-3.c new file mode 100644 index 000000000..7a35eb6d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050215-3.c @@ -0,0 +1,8 @@ +/* PR tree-optimization/18947 */ +int v; +extern __inline void f0 (void) { v++; } +extern __inline void f1 (void) { f0 (); } +void f4 (void) { f1 (); } +extern __inline void f2 (void) { f1 (); } +void f3 (void) { f2 (); } +void f2 (void) { f1 (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20050217-1.c b/gcc/testsuite/gcc.c-torture/compile/20050217-1.c new file mode 100644 index 000000000..f4b928d1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050217-1.c @@ -0,0 +1,14 @@ +/* PR c++/20023 */ + +void f (void); +typedef __SIZE_TYPE__ size_t; +void g (void *a) +{ + size_t b = (size_t) a; + switch (b) + { + case 1: + f (); + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050303-1.c b/gcc/testsuite/gcc.c-torture/compile/20050303-1.c new file mode 100644 index 000000000..22154b30a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050303-1.c @@ -0,0 +1,13 @@ +/* { dg-require-effective-target int32plus } */ +/* { dg-require-effective-target size32plus } */ + +void crc() +{ + int toread; + long long nleft; + unsigned char buf[(128 * 1024)]; + + nleft = 0; + while (toread = (nleft < (2147483647 * 2U + 1U)) ? nleft: (2147483647 * 2U + 1U) ) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050328-1.c b/gcc/testsuite/gcc.c-torture/compile/20050328-1.c new file mode 100644 index 000000000..a68574f1f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050328-1.c @@ -0,0 +1,24 @@ +void fn1 (void *); +void fn2 (void *); +void foo (void); +void bar (void); + +extern inline void * +baz (void) +{ + return 0; +} + +void +foo (void) +{ + fn1 (baz ()); + fn2 (baz ()); +} + +void +bar (void) +{ + fn1 (baz ()); + fn2 (baz); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050423-1.c b/gcc/testsuite/gcc.c-torture/compile/20050423-1.c new file mode 100644 index 000000000..fee5eb909 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050423-1.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/20742 */ + +int +foo (int x, int y) +{ + register int a = y + 57; + register int b = y + 31; + + while (x-- > 0) + { + #define TEN(x) x x x x x x x x x x + TEN (TEN (a += b; b -= a;)) + TEN (TEN (a += b; b -= a;)) + } + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050510-1.c b/gcc/testsuite/gcc.c-torture/compile/20050510-1.c new file mode 100644 index 000000000..3570f4f35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050510-1.c @@ -0,0 +1,12 @@ +void bar (int k) +{ + void *label = (k) ? &&x : &&y; + if (k) + goto *label; + +x: + if (k) + dont_remove (); +y: + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050516-1.c b/gcc/testsuite/gcc.c-torture/compile/20050516-1.c new file mode 100644 index 000000000..2cdf69608 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050516-1.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/21610 */ + +struct S { char s; }; +struct T { struct S t; }; + +struct S *const p = &((struct T * const) (0x4000))->t; + +void +foo (void) +{ + p->s = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050520-1.c b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c new file mode 100644 index 000000000..9e2f6c8c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c @@ -0,0 +1,13 @@ +struct s { int x[4]; }; +struct s gs; + +void +bar (void) +{ + struct s *s; + int i; + + s = &gs; + for (i = 0; i < 4; i++) + ((char*) (&s->x[i]))[0] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050622-1.c b/gcc/testsuite/gcc.c-torture/compile/20050622-1.c new file mode 100644 index 000000000..db183909f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050622-1.c @@ -0,0 +1,16 @@ +#if __SCHAR_MAX__ == 127 && __INT_MAX__ >= 2147483647 +struct S { char buf[72*1024*1024]; }; +#else +struct S { char buf[64]; }; +#endif + +extern void bar (struct S); + +struct S s; + +int +foo (void) +{ + bar (s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050721-1.c b/gcc/testsuite/gcc.c-torture/compile/20050721-1.c new file mode 100644 index 000000000..25a781ddd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050721-1.c @@ -0,0 +1,57 @@ +/* Test for PR target/20191. */ + +struct S1; + +struct S1 { + struct S1 *next; + float x; +}; + +struct S2 { + float y; +}; + +extern int func_ex1 (float); + +extern int f; +extern float n; +extern struct S1 *bp1; +extern struct S2 *bp2; + +inline float +func1 (int f, struct S2 *p2) +{ + float a; + + if (f) + a = n >= p2->y ? n : p2->y; + else + a = n; + return a; +} + +inline float +func2 (struct S1 *p1, struct S2 *p2) +{ + float a, b; + + if(n <= 1.0) + b = func1 (f, p2); + else + { + a = n <= p1->x ? 0.0 : p1->x; + b = a >= p2->y ? a : p2->y; + } + return(b); +} + +void +func3 (struct S1 *p) +{ + float a = 0.0; + + if (f) + a = func2 (bp1, bp2); + if (func_ex1 (a)) + bp1 = p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050801-1.c b/gcc/testsuite/gcc.c-torture/compile/20050801-1.c new file mode 100644 index 000000000..7e32166a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050801-1.c @@ -0,0 +1,8 @@ +__inline void libc_name_p (void) +{ + enum { A = 1 }; +} +void nothrow_libfn_p (void) +{ + libc_name_p (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050801-2.c b/gcc/testsuite/gcc.c-torture/compile/20050801-2.c new file mode 100644 index 000000000..45bd2a037 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050801-2.c @@ -0,0 +1,12 @@ +__inline int f(int i) +{ + struct { + int t[i]; + } t; + return sizeof(t.t[i--]); +} + +int g(int i) +{ + return f(i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20051207-1.c b/gcc/testsuite/gcc.c-torture/compile/20051207-1.c new file mode 100644 index 000000000..9baa63b94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20051207-1.c @@ -0,0 +1,7 @@ +/* PR target/25268 */ + +long long +foo (long long x, int y) +{ + return x << ((y + 1) & 63); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20051216-1.c b/gcc/testsuite/gcc.c-torture/compile/20051216-1.c new file mode 100644 index 000000000..ed6ac7230 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20051216-1.c @@ -0,0 +1,131 @@ +/* PR rtl-optimization/25432 */ + +void *malloc (__SIZE_TYPE__); +void *realloc (void *, __SIZE_TYPE__); + +struct A { double x, y; }; +struct B { double x0, y0, x1, y1; }; +struct C { int n_points; int dir; struct B bbox; struct A *points; }; +struct D { int n_segs; struct C segs[1]; }; + +void foo (int, int, int *, int, int *, struct A **, int *, int *, + struct D *, int *, struct D **, int *, int **); +int baz (struct A, struct A, struct A, struct A); + +static void +bar (struct D *svp, int *n_points_max, + struct A p, int *seg_map, int *active_segs, int i) +{ + int asi, n_points; + struct C *seg; + + asi = seg_map[active_segs[i]]; + seg = &svp->segs[asi]; + n_points = seg->n_points; + seg->points = ((struct A *) + realloc (seg->points, (n_points_max[asi] <<= 1) * sizeof (struct A))); + seg->points[n_points] = p; + seg->bbox.y1 = p.y; + seg->n_points++; +} + +struct D * +test (struct D *vp) +{ + int *active_segs, n_active_segs, *cursor, seg_idx; + double y, share_x; + int tmp1, tmp2, asi, i, j, *n_ips, *n_ips_max, n_segs_max; + struct A **ips, p_curs, *pts; + struct D *new_vp; + int *n_points_max, *seg_map, first_share; + + n_segs_max = 16; + new_vp = (struct D *) malloc (sizeof (struct D) + + (n_segs_max - 1) * sizeof (struct C)); + new_vp->n_segs = 0; + + if (vp->n_segs == 0) + return new_vp; + + active_segs = ((int *) malloc ((vp->n_segs) * sizeof (int))); + cursor = ((int *) malloc ((vp->n_segs) * sizeof (int))); + + seg_map = ((int *) malloc ((vp->n_segs) * sizeof (int))); + n_ips = ((int *) malloc ((vp->n_segs) * sizeof (int))); + n_ips_max = ((int *) malloc ((vp->n_segs) * sizeof (int))); + ips = ((struct A * *) malloc ((vp->n_segs) * sizeof (struct A *))); + + n_points_max = ((int *) malloc ((n_segs_max) * sizeof (int))); + + n_active_segs = 0; + seg_idx = 0; + y = vp->segs[0].points[0].y; + while (seg_idx < vp->n_segs || n_active_segs > 0) + { + for (i = 0; i < n_active_segs; i++) + { + asi = active_segs[i]; + if (vp->segs[asi].n_points - 1 == cursor[asi] && + vp->segs[asi].points[cursor[asi]].y == y) + i--; + } + + while (seg_idx < vp->n_segs && y == vp->segs[seg_idx].points[0].y) + { + cursor[seg_idx] = 0; + n_ips[seg_idx] = 1; + n_ips_max[seg_idx] = 2; + ips[seg_idx] = + ((struct A *) malloc ((n_ips_max[seg_idx]) * sizeof (struct A))); + ips[seg_idx][0] = vp->segs[seg_idx].points[0]; + pts = ((struct A *) malloc ((16) * sizeof (struct A))); + pts[0] = vp->segs[seg_idx].points[0]; + tmp1 = seg_idx; + for (j = i; j < n_active_segs; j++) + { + tmp2 = active_segs[j]; + active_segs[j] = tmp1; + tmp1 = tmp2; + } + active_segs[n_active_segs] = tmp1; + n_active_segs++; + seg_idx++; + } + first_share = -1; + share_x = 0; + + for (i = 0; i < n_active_segs; i++) + { + asi = active_segs[i]; + p_curs = ips[asi][1]; + if (p_curs.y == y) + { + bar (new_vp, n_points_max, + p_curs, seg_map, active_segs, i); + + n_ips[asi]--; + for (j = 0; j < n_ips[asi]; j++) + ips[asi][j] = ips[asi][j + 1]; + + if (first_share < 0 || p_curs.x != share_x) + { + foo (first_share, i, + active_segs, n_active_segs, + cursor, ips, n_ips, n_ips_max, vp, seg_map, + &new_vp, &n_segs_max, &n_points_max); + first_share = i; + share_x = p_curs.x; + } + } + else + { + foo (first_share, i, + active_segs, n_active_segs, + cursor, ips, n_ips, n_ips_max, vp, seg_map, + &new_vp, &n_segs_max, &n_points_max); + first_share = -1; + } + } + } + return new_vp; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20051228-1.c b/gcc/testsuite/gcc.c-torture/compile/20051228-1.c new file mode 100644 index 000000000..e997ae394 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20051228-1.c @@ -0,0 +1,10 @@ +/* PR target/25554 */ +/* Bitwise shift with negative shift count has undefined behavior, + but we shouldn't ICE on it. */ + +void +foo (long x) +{ + if (((x >> -2) & 1) != 0) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060109-1.c b/gcc/testsuite/gcc.c-torture/compile/20060109-1.c new file mode 100644 index 000000000..9ef9c2fdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060109-1.c @@ -0,0 +1,36 @@ +/* This test exposed a bug in combine where it was improperly changing + the mode of a register. The bug appeared to be latent until web + was moved after combine. This is the reduced test that fails + by crashing in reload. */ + + +typedef struct cpp_reader cpp_reader; +typedef struct cpp_string cpp_string; +struct cpp_string +{ + unsigned int len; + const unsigned char *text; +}; +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 +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 new file mode 100644 index 000000000..d16e7b7c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c @@ -0,0 +1,54 @@ +typedef __SIZE_TYPE__ size_t; +typedef const struct objc_selector +{ + void *sel_id; +} + *SEL; +typedef struct objc_object +{ +} + *id; +typedef struct objc_class *Class; +struct objc_class +{ + struct sarray *dtable; +}; +typedef size_t sidx; +struct soffset +{ + unsigned int boffset:(sizeof (size_t) * 8) / 2; + unsigned int eoffset:(sizeof (size_t) * 8) / 2; +}; +union sofftype +{ + struct soffset off; + sidx idx; +}; +struct sarray +{ + size_t capacity; +}; +static __inline__ unsigned int +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); +} +void * +get_imp (Class class, SEL sel) +{ + void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); + if (res == 0) + { + { + res = get_imp (class, sel); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060208-1.c b/gcc/testsuite/gcc.c-torture/compile/20060208-1.c new file mode 100644 index 000000000..01e471a7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060208-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/26092 */ +typedef __SIZE_TYPE__ size_t; +extern void *malloc (size_t); + +void *(*const foo) (size_t) = malloc; + +void *test (void) +{ + return (*foo) (3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060215-1.c b/gcc/testsuite/gcc.c-torture/compile/20060215-1.c new file mode 100644 index 000000000..7979561a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060215-1.c @@ -0,0 +1,42 @@ +/* PR middle-end/26300 */ + +struct S +{ + char c; + struct S *d; + struct S *e; +}; +extern struct S *u, *v; +extern void fn1 (struct S *) __attribute__ ((noreturn)); +void fn2 (struct S *); + +static inline struct S * +fn3 (struct S *x) +{ + if (x->c != 6) + fn1 (0); + return (struct S *) x; +} + +static inline int +fn4 (struct S *x) +{ + if (x != u) + return 3; + fn2 (x); + return 0; +} + +int +test (struct S *x) +{ + struct S *r; + int m = 0; + + for (r = x; r != v; r = (fn3 (r)->d)) + if (r->c != 6) + fn1 (x); + else + m |= 1 << (fn4 (fn3 (r)->e) - 1); + return m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060217-1.c b/gcc/testsuite/gcc.c-torture/compile/20060217-1.c new file mode 100644 index 000000000..c447142bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060217-1.c @@ -0,0 +1,25 @@ +/* PR middle-end/26334 */ + +struct U +{ + unsigned int u[256]; +}; + +struct S +{ + int u, v, w, x; + int s[255]; +}; + +int +foo (struct U *x, struct S *y) +{ + register int i; + for (i = 0; i < 255; i++) + { + unsigned int v; + __asm__ ("" : "=r" (v) : "0" (x->u[i + 1]) : "cc"); + y->s[i] = v; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060309-1.c b/gcc/testsuite/gcc.c-torture/compile/20060309-1.c new file mode 100644 index 000000000..4aff45b62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060309-1.c @@ -0,0 +1,3 @@ +/* Test to make sure that indirect jumps compile. */ +extern void bar(void); +void foo() { bar(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20060419-1.c b/gcc/testsuite/gcc.c-torture/compile/20060419-1.c new file mode 100644 index 000000000..dc346ae02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060419-1.c @@ -0,0 +1,21 @@ +/* This failed because if conversion didn't handle insv patterns properly. */ + +union y +{ + int a; + unsigned short b; +}; + +extern void bar (unsigned short u, union y v); + +void +foo (int check) +{ + union y x; + + if (check != 0) + x.b = 1; + else + x.b = 2; + bar (x.b, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060421-1.c b/gcc/testsuite/gcc.c-torture/compile/20060421-1.c new file mode 100644 index 000000000..1bd4079b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060421-1.c @@ -0,0 +1,9 @@ +/* This test used to ICE on ARM with -mcpu=iwmmxt. */ +void +foo (void) +{ + long long int a; + unsigned long b[249]; /* >= 249 causes failure */ + register unsigned int c; + b[c] = (a & (1ULL << c)) ? 1 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060609-1.c b/gcc/testsuite/gcc.c-torture/compile/20060609-1.c new file mode 100644 index 000000000..a8152c8a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060609-1.c @@ -0,0 +1,7 @@ +/* This test used to ICE on IA64. */ +int __strspn_c2 (__const char *__s, int __accept1, int __accept2) +{ + register long unsigned int __result = 0; + while (__s[__result] == __accept1 || __s[__result] == __accept2) + return __result; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060625-1.c b/gcc/testsuite/gcc.c-torture/compile/20060625-1.c new file mode 100644 index 000000000..37efb9da6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060625-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/28151 */ +/* Testcase by Steven Bosscher <stevenb.gcc@gmail.com> */ + +_Complex float b; + +void foo (void) +{ + _Complex float a = __FLT_MAX__; + b = __FLT_MAX__ + a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060823-1.c b/gcc/testsuite/gcc.c-torture/compile/20060823-1.c new file mode 100644 index 000000000..fbce7fe94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060823-1.c @@ -0,0 +1,18 @@ +/* PR middle-end/28683 */ + +extern void foo (int *); + +struct A +{ + int f; +}; + +struct A * +test (struct A *r) +{ + int *f = &r->f; + static int i = 0; + if (!i && !((void *) f == (void *) r)) + foo (&i); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060826-1.c b/gcc/testsuite/gcc.c-torture/compile/20060826-1.c new file mode 100644 index 000000000..06fb4ebad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060826-1.c @@ -0,0 +1,7 @@ +typedef _Complex double S; +S bar (void); +void quux (S, S); +void foo (void) +{ + quux (bar(), bar()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060904-1.c b/gcc/testsuite/gcc.c-torture/compile/20060904-1.c new file mode 100644 index 000000000..f9f768664 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060904-1.c @@ -0,0 +1,27 @@ +/* PR rtl-optimization/27616 */ +/* Reported by Lee Ji Hwan <moonz@kaist.ac.kr> */ +/* Testcase by Andrew Pinski <pinskia@gcc.gnu.org> */ + +struct chunk_s +{ + unsigned int size; + int offset_next; +}; + +typedef struct chunk_s chunk_t; + +void foo(chunk_t *first) +{ + chunk_t *cur; + char *first0; + + do { + first0 = (char *) first; + cur = (chunk_t *) (first0 + first->offset_next); + if ((chunk_t *) (first0 + cur->offset_next) != first) + return ; + + first->offset_next = 0; + + } while (cur->size != 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20061005-1.c b/gcc/testsuite/gcc.c-torture/compile/20061005-1.c new file mode 100644 index 000000000..a433509ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20061005-1.c @@ -0,0 +1,23 @@ +/* PR target/28924 */ + +char c; + +void +testc (void) +{ + (void) __sync_fetch_and_add (&c, -1); +} + +short s; + +void +tests (void) +{ + (void) __sync_fetch_and_add (&s, -1); +} + +void +testc2 (void) +{ + (void) __sync_val_compare_and_swap (&c, -1, -3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20061214-1.c b/gcc/testsuite/gcc.c-torture/compile/20061214-1.c new file mode 100644 index 000000000..1e65a2a6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20061214-1.c @@ -0,0 +1,7 @@ +typedef unsigned long long ull; +ull bar (void); +void foo (ull *x) +{ + ull y = bar (); + *x += y >> 32; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070121.c b/gcc/testsuite/gcc.c-torture/compile/20070121.c new file mode 100644 index 000000000..88af8bf62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070121.c @@ -0,0 +1,18 @@ +/* PR rtl-optimization/29329 */ +/* Origin: Debian GCC Maintainers <debian-gcc@lists.debian.org> */ +/* Testcase by: Andrew Pinski <pinskia@gmail.com> */ + +struct node234_Tag +{ + int t1; + int kids[4]; + void *elems[3]; +}; + +void *add234_internal(struct node234_Tag *n, int ei) +{ + int j; + for (j = ei; j < 2 && n->elems[j+1];) + j++; + n->kids[j+1] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070129.c b/gcc/testsuite/gcc.c-torture/compile/20070129.c new file mode 100644 index 000000000..3204d9658 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070129.c @@ -0,0 +1,94 @@ +/* This testcase would cause a hang in PTA solving due to a complex copy + constraint and marking the wrong variable as changed. */ + +typedef struct RExC_state_t +{ + char *end; + char *parse; +} RExC_state_t; + +struct regnode_string +{ + unsigned char str_len; + char string[1]; +}; + +static void *regatom (RExC_state_t * pRExC_state, int *flagp); + +static void * +regpiece (RExC_state_t * pRExC_state, int *flagp) +{ + return regatom (0, 0); +} + +static void * +regbranch (RExC_state_t * pRExC_state, int *flagp, int first) +{ + return regpiece (0, 0); +} + +static void * +reg (RExC_state_t * pRExC_state, int paren, int *flagp) +{ + return regbranch (0, 0, 1); +} + +void * +Perl_pregcomp (char *exp, char *xend, void *pm) +{ + return reg (0, 0, 0); +} + +static void * +regatom (RExC_state_t * pRExC_state, int *flagp) +{ + register void *ret = 0; + int flags; + +tryagain: + switch (*(pRExC_state->parse)) + { + case '(': + ret = reg (pRExC_state, 1, &flags); + if (flags & 0x8) + { + goto tryagain; + } + break; + default: + { + register unsigned long len; + register unsigned ender; + register char *p; + char *oldp, *s; + unsigned long numlen; + unsigned long foldlen; + unsigned char tmpbuf[6 + 1], *foldbuf; + + defchar: + s = (((struct regnode_string *) ret)->string); + for (len = 0, p = (pRExC_state->parse) - 1; + len < 127 && p < (pRExC_state->end); len++) + { + if (((*p) == '*' || (*p) == '+' || (*p) == '?' + || ((*p) == '{' && regcurly (p)))) + { + unsigned long unilen; + for (foldbuf = tmpbuf; foldlen; foldlen -= numlen) + { + reguni (pRExC_state, ender, s, &unilen); + s += unilen; + } + break; + } + unsigned long unilen; + + reguni (pRExC_state, ender, s, &unilen); + s += unilen; + } + + }; + break; + } + return (ret); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070419-1.c b/gcc/testsuite/gcc.c-torture/compile/20070419-1.c new file mode 100644 index 000000000..ea23bf8bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070419-1.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/31632 */ + +struct S +{ + long int l; + void *m; +}; + +int +foo (struct S *x) +{ + unsigned long a; + a = x->l; + if (a <= ((void *) 0)) + x->m = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070501-1.c b/gcc/testsuite/gcc.c-torture/compile/20070501-1.c new file mode 100644 index 000000000..39acd49de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070501-1.c @@ -0,0 +1,16 @@ + typedef signed int signed16 __attribute__ ((__mode__ (__HI__))); + typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__))); + typedef signed16 HI; + typedef unsigned16 UHI; +unsigned short f(int y) +{ + HI tmp_b4; + tmp_b4 = y; + UHI opval; + if (tmp_b4 == -32768) + opval = 32767; + else + opval = -tmp_b4; + return opval; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20070520-1.c b/gcc/testsuite/gcc.c-torture/compile/20070520-1.c new file mode 100644 index 000000000..fe9db9747 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070520-1.c @@ -0,0 +1,35 @@ +typedef unsigned char uint8_t; +extern uint8_t ff_cropTbl[256 + 2 * 1024]; + +void ff_pred8x8_plane_c(uint8_t *src, int stride){ + int j, k; + int a; + uint8_t *cm = ff_cropTbl + 1024; + const uint8_t * const src0 = src+3-stride; + const uint8_t *src1 = src+4*stride-1; + const uint8_t *src2 = src1-2*stride; + int H = src0[1] - src0[-1]; + int V = src1[0] - src2[ 0]; + for(k=2; k<=4; ++k) { + src1 += stride; src2 -= stride; + H += k*(src0[k] - src0[-k]); + V += k*(src1[0] - src2[ 0]); + } + H = ( 17*H+16 ) >> 5; + V = ( 17*V+16 ) >> 5; + + a = 16*(src1[0] + src2[8]+1) - 3*(V+H); + for(j=8; j>0; --j) { + int b = a; + a += V; + src[0] = cm[ (b ) >> 5 ]; + src[1] = cm[ (b+ H) >> 5 ]; + src[2] = cm[ (b+2*H) >> 5 ]; + src[3] = cm[ (b+3*H) >> 5 ]; + src[4] = cm[ (b+4*H) >> 5 ]; + src[5] = cm[ (b+5*H) >> 5 ]; + src[6] = cm[ (b+6*H) >> 5 ]; + src[7] = cm[ (b+7*H) >> 5 ]; + src += stride; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070522-1.c b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c new file mode 100644 index 000000000..1e1e8020d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c @@ -0,0 +1,13 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +/* This was PR 31606, we were trying to use TImode to expand the + struct copy in SRA but TImode is not support on ia32. */ + +struct Collision { + int edge; + int triangle; + float _M_instance[3] __attribute__((__aligned__)); +}; +void get_collisions(struct Collision a) { + struct Collision b = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070529-1.c b/gcc/testsuite/gcc.c-torture/compile/20070529-1.c new file mode 100644 index 000000000..f34add2b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070529-1.c @@ -0,0 +1,16 @@ +/* ICE in chrec_fold_plus_poly_poly. */ + +typedef unsigned short __u16; +typedef unsigned int u32; +typedef __u16 __be16; +struct hfs_extent { + __be16 count; +}; +int hfs_free_fork( int type) +{ + u32 total_blocks, blocks, start; + struct hfs_extent *extent; + int res, i; + for (i = 0; i < 3; extent++, i++) + blocks += __fswab16((( __u16)(__be16)(extent[i].count))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070529-2.c b/gcc/testsuite/gcc.c-torture/compile/20070529-2.c new file mode 100644 index 000000000..cb38d2061 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070529-2.c @@ -0,0 +1,11 @@ +void xfs_dir2_grow_inode(void) +{ + int map; + int *mapp; + int nmap; + mapp = ↦ + if (nmap == 0 ) + mapp = ((void *)0); + if (mapp != &map) + kmem_free(mapp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070531-1.c b/gcc/testsuite/gcc.c-torture/compile/20070531-1.c new file mode 100644 index 000000000..90ecbb88d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070531-1.c @@ -0,0 +1,11 @@ +/* MIN_EXPR/MAX_EXPR caused an ICE in VRP. */ +int *f(int *a, int *b) +{ + *a = 1; + *b = 2; + int *c = a < b ? a : b; + if (c) + return c; + else + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070531-2.c b/gcc/testsuite/gcc.c-torture/compile/20070531-2.c new file mode 100644 index 000000000..967180e0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070531-2.c @@ -0,0 +1,6 @@ +int f(void) +{ + int *a = 0; + for(a = 0; a < (int*)32767;a++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070603-1.c b/gcc/testsuite/gcc.c-torture/compile/20070603-1.c new file mode 100644 index 000000000..94e2baf13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070603-1.c @@ -0,0 +1,9 @@ + +int f(_Complex double *a, unsigned int n) +{ + unsigned int i; + for(i = 0; i< n; i++) + { + a[i] = __real__ a[i+1] + __real__ a[i]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070603-2.c b/gcc/testsuite/gcc.c-torture/compile/20070603-2.c new file mode 100644 index 000000000..7aaa8c2ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070603-2.c @@ -0,0 +1,9 @@ +typedef _Complex double ar[]; +int f(ar *a, unsigned int n) +{ + unsigned int i; + for(i = 0; i< n; i++) + { + (*a)[i*4] = __real__ (*a)[(i+1)*4] + __real__ (*a)[i*4]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070605-1.c b/gcc/testsuite/gcc.c-torture/compile/20070605-1.c new file mode 100644 index 000000000..8bf53253c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070605-1.c @@ -0,0 +1,10 @@ +quantize_fs_dither (unsigned width, short *errorptr, int dir) +{ + short bpreverr; + unsigned col; + for (col = width; col > 0; col--) + errorptr += dir; + errorptr[0] = (short) bpreverr; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20070827-1.c b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c new file mode 100644 index 000000000..5dd009974 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/33148 */ + +int +foo (unsigned int *p, int *q, unsigned int w, unsigned int b) +{ + unsigned int i; + int mask; + + if (q[0] < q[1]) + mask = 0xff; + else + mask = 0; + + for (i = 0; 8 * i < w; i++) + { + b ^= mask; + *p++ = b; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070905-1.c b/gcc/testsuite/gcc.c-torture/compile/20070905-1.c new file mode 100644 index 000000000..5953275b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070905-1.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/32772 */ + +struct S +{ + unsigned long bits[1]; +}; + +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); +} + +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); + for (n = f2 (); n < 8; n = f2 ()) + f3 (n, y->bits); +} + +void +foo (int x, int y) +{ + struct S m; + while ((y = bar (x, &m)) >= 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070906-1.c b/gcc/testsuite/gcc.c-torture/compile/20070906-1.c new file mode 100644 index 000000000..bec983f24 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070906-1.c @@ -0,0 +1,8 @@ +struct Bar { + int i[8]; +}; +struct Bar foo(struct Bar **p) +{ + return foo((struct Bar**)*p); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20070915-1.c b/gcc/testsuite/gcc.c-torture/compile/20070915-1.c new file mode 100644 index 000000000..1cd64e5ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070915-1.c @@ -0,0 +1,20 @@ +/* PR middle-end/33423 */ + +static struct +{ + char buf[15]; +} u2; + +void +test6 (void) +{ + int len; + char *p; + + for (len = 0; len < 2; len++) + { + p = __builtin___memset_chk (u2.buf, '\0', len, 15); + if (p != u2.buf) + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070919-1.c b/gcc/testsuite/gcc.c-torture/compile/20070919-1.c new file mode 100644 index 000000000..91c444926 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070919-1.c @@ -0,0 +1,31 @@ +typedef short int int16_t; +typedef unsigned char uint8_t; +typedef struct { + int16_t LARc[8]; + int16_t Nc[4]; + int16_t bc[4]; + int16_t Mc[4]; + int16_t xmaxc[4]; + int16_t xMc[4][13]; +} gsm0610_frame_t; +int gsm0610_unpack_voip(gsm0610_frame_t * s, const uint8_t c[33]) +{ + int i; + for (i = 0; i < 4; i++) { + s->Nc[i] = (*c >> 1) & 0x7F; + s->bc[i] = (*c++ & 0x1) << 1; + s->bc[i] |= (*c >> 7) & 0x1; + s->Mc[i] = (*c >> 5) & 0x3; + s->xmaxc[i] = (*c++ & 0x1F) << 1; + s->xmaxc[i] |= (*c >> 7) & 0x1; + s->xMc[i][0] = (*c >> 4) & 0x7; + s->xMc[i][1] = (*c >> 1) & 0x7; + s->xMc[i][2] = (*c++ & 0x1) << 2; + s->xMc[i][2] |= (*c >> 6) & 0x3; + s->xMc[i][3] = (*c >> 3) & 0x7; + s->xMc[i][4] = *c++ & 0x7; + s->xMc[i][10] |= (*c >> 6) & 0x3; + s->xMc[i][11] = (*c >> 3) & 0x7; + s->xMc[i][12] = *c++ & 0x7; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071027-1.c b/gcc/testsuite/gcc.c-torture/compile/20071027-1.c new file mode 100644 index 000000000..c55040621 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071027-1.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/33856 */ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +typedef struct z_key +{ + int key; + int mask; +} z_key; +typedef struct picture_size +{ + z_key key; +} picture_size; + +void picture_size_new (picture_size *ps) +{ + z_key key; + ps->key = key; +} + +void picture_sizes_load_default (picture_size *ps) +{ + int i; + for (i = 0; i < 5; ++i) + picture_size_new (ps); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071102-1.c b/gcc/testsuite/gcc.c-torture/compile/20071102-1.c new file mode 100644 index 000000000..03b015628 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071102-1.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/28062 */ +/* Original testcase by Martin Michlmayr <tbm@cyrius.com> */ +/* C testcase by Andrew Pinski <pinskia@gcc.gnu.org> */ + +struct _NSPoint +{ + float x; + float y; +}; + +typedef struct _NSPoint NSPoint; + +static inline NSPoint +NSMakePoint (float x, float y) +{ + NSPoint point; + point.x = x; + point.y = y; + return point; +} + +static inline NSPoint +RelativePoint (NSPoint point, NSPoint refPoint) +{ + return NSMakePoint (refPoint.x + point.x, refPoint.y + point.y); +} + +NSPoint g(NSPoint refPoint) +{ + float pointA, pointB; + return RelativePoint (NSMakePoint (0, pointA), refPoint); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071105-1.c b/gcc/testsuite/gcc.c-torture/compile/20071105-1.c new file mode 100644 index 000000000..952b1bd69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071105-1.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/33993 */ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +void +init_full (char *array, int ny) +{ + int j; + char acc = 128; + for (j = 0; j < ny; j++) + *array++ = acc++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071107-1.c b/gcc/testsuite/gcc.c-torture/compile/20071107-1.c new file mode 100644 index 000000000..627b705d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071107-1.c @@ -0,0 +1,332 @@ +/* PR rtl-optimization/33737 */ +/* Testcase by Richard Guenther <rguenth@gcc.gnu.org> */ + +enum { PROP_0, PROP_DOUBLE_CLICK_TIME, PROP_DOUBLE_CLICK_DISTANCE, PROP_CURSOR_BLINK, PROP_CURSOR_BLINK_TIME, PROP_CURSOR_BLINK_TIMEOUT, PROP_SPLIT_CURSOR, PROP_THEME_NAME, PROP_ICON_THEME_NAME, PROP_FALLBACK_ICON_THEME, PROP_KEY_THEME_NAME, PROP_MENU_BAR_ACCEL, PROP_DND_DRAG_THRESHOLD, PROP_FONT_NAME, PROP_ICON_SIZES, PROP_MODULES, PROP_XFT_ANTIALIAS, PROP_XFT_HINTING, PROP_XFT_HINTSTYLE, PROP_XFT_RGBA, PROP_XFT_DPI, PROP_CURSOR_THEME_NAME, PROP_CURSOR_THEME_SIZE, PROP_ALTERNATIVE_BUTTON_ORDER, PROP_ALTERNATIVE_SORT_ARROWS, PROP_SHOW_INPUT_METHOD_MENU, PROP_SHOW_UNICODE_MENU, PROP_TIMEOUT_INITIAL, PROP_TIMEOUT_REPEAT, PROP_TIMEOUT_EXPAND, PROP_COLOR_SCHEME, PROP_ENABLE_ANIMATIONS, PROP_TOUCHSCREEN_MODE, PROP_TOOLTIP_TIMEOUT, PROP_TOOLTIP_BROWSE_TIMEOUT, PROP_TOOLTIP_BROWSE_MODE_TIMEOUT, PROP_KEYNAV_CURSOR_ONLY, PROP_KEYNAV_WRAP_AROUND, PROP_ERROR_BELL, PROP_COLOR_HASH, PROP_FILE_CHOOSER_BACKEND, PROP_PRINT_BACKENDS, PROP_PRINT_PREVIEW_COMMAND, PROP_ENABLE_MNEMONICS, PROP_ENABLE_ACCELS, PROP_RECENT_FILES_LIMIT }; +void g_assert_warning (void) __attribute__((__noreturn__)); +void gtk_settings_class_init (void) +{ + unsigned int result; + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_DOUBLE_CLICK_TIME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_DOUBLE_CLICK_DISTANCE) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_BLINK) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_BLINK_TIME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_BLINK_TIMEOUT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_SPLIT_CURSOR) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ICON_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_FALLBACK_ICON_THEME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_KEY_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_MENU_BAR_ACCEL) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_DND_DRAG_THRESHOLD) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_FONT_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ICON_SIZES) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_MODULES) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_ANTIALIAS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_HINTING) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_HINTSTYLE) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_RGBA) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_DPI) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_THEME_SIZE) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ALTERNATIVE_BUTTON_ORDER) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ALTERNATIVE_SORT_ARROWS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_SHOW_INPUT_METHOD_MENU) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_SHOW_UNICODE_MENU) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_TOOLTIP_BROWSE_TIMEOUT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_TOOLTIP_BROWSE_MODE_TIMEOUT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_KEYNAV_CURSOR_ONLY) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_KEYNAV_WRAP_AROUND) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ERROR_BELL) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_FILE_CHOOSER_BACKEND) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_PRINT_PREVIEW_COMMAND) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ENABLE_MNEMONICS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ENABLE_ACCELS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_RECENT_FILES_LIMIT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071108-1.c b/gcc/testsuite/gcc.c-torture/compile/20071108-1.c new file mode 100644 index 000000000..b9a36ef65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071108-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/33680 */ + +int +f (int dim, int *b, int *c) +{ + int newcentroid[3][dim]; + int *a = newcentroid[2]; + int i, dist = 0; + __builtin_memcpy (newcentroid, c, sizeof (newcentroid)); + for (i = 0; i < dim; i++) + dist += (a[i] - b[i]) * (a[i] - b[i]); + return dist; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071114-1.c b/gcc/testsuite/gcc.c-torture/compile/20071114-1.c new file mode 100644 index 000000000..ddfbfefff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071114-1.c @@ -0,0 +1,113 @@ +/* PR tree-optimization/34046 */ +/* Origin: dcb <dcb314@hotmail.com> */ + +typedef unsigned char bool8; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; + +struct SIAPU +{ + uint8 *PC; + uint8 *RAM; + uint8 Bit; + uint32 Address; + uint8 *WaitAddress1; + uint8 *WaitAddress2; + uint8 _Carry; +}; + +struct SAPU +{ + bool8 ShowROM; + uint8 OutPorts [4]; + uint8 ExtraRAM [64]; + uint16 TimerTarget [3]; +}; + +struct SAPU APU; +struct SIAPU IAPU; + +void S9xSetAPUControl (uint8 byte); +void S9xSetAPUDSP (uint8 byte); +uint8 S9xGetAPUDSP (); + +uint8 S9xAPUGetByte (uint32 Address) +{ + Address &= 0xffff; + + if (Address <= 0xff && Address >= 0xf0) + { + if (Address >= 0xf4 && Address <= 0xf7) + { + IAPU.WaitAddress2 = IAPU.WaitAddress1; + IAPU.WaitAddress1 = IAPU.PC; + return (IAPU.RAM [Address]); + } + else if (Address == 0xf3) + return (S9xGetAPUDSP ()); + + if (Address >= 0xfd) + { + IAPU.WaitAddress2 = IAPU.WaitAddress1; + IAPU.WaitAddress1 = IAPU.PC; + uint8 t = IAPU.RAM [Address]; + IAPU.RAM [Address] = 0; + return (t); + } + + return (IAPU.RAM [Address]); + } + else + return (IAPU.RAM [Address]); +} + +void S9xAPUSetByte (uint8 byte, uint32 Address) +{ + Address &= 0xffff; + + if (Address <= 0xff && Address >= 0xf0) + { + if (Address == 0xf3) + S9xSetAPUDSP (byte); + else if (Address >= 0xf4 && Address <= 0xf7) + APU.OutPorts [Address - 0xf4] = byte; + else if (Address == 0xf1) + S9xSetAPUControl (byte); + else if (Address < 0xfd) + { + IAPU.RAM [Address] = byte; + if (Address >= 0xfa) + { + if (byte == 0) + APU.TimerTarget [Address - 0xfa] = 0x100; + else + APU.TimerTarget [Address - 0xfa] = byte; + } + } + } + else + { + if (Address < 0xffc0) + IAPU.RAM [Address] = byte; + else + { + APU.ExtraRAM [Address - 0xffc0] = byte; + if (!APU.ShowROM) + IAPU.RAM [Address] = byte; + } + } +} + +void ApuCA () +{ + IAPU.Address = *(uint16 *) (IAPU.PC + 1); + IAPU.Bit = (uint8)(IAPU.Address >> 13); + if ((IAPU._Carry)) + S9xAPUSetByte (S9xAPUGetByte (IAPU.Address) | (1 << IAPU.Bit), IAPU.Address); + else + S9xAPUSetByte (S9xAPUGetByte (IAPU.Address) & ~(1 << IAPU.Bit), IAPU.Address); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071117-1.c b/gcc/testsuite/gcc.c-torture/compile/20071117-1.c new file mode 100644 index 000000000..efcd51269 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071117-1.c @@ -0,0 +1,13 @@ +/* PR middle-end/34134 */ + +extern void bar (void *, int); + +int foo (int i) +{ + char *p = __builtin_stack_save (); + void *q = __builtin_alloca (i); + bar (q, i); + __builtin_stack_restore (p); + bar ("", 0); + return 6; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071118-1.c b/gcc/testsuite/gcc.c-torture/compile/20071118-1.c new file mode 100644 index 000000000..d093d3fd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071118-1.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/34132 */ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +static char *m = "%s%u.msg"; +extern void bar (int, const char *); +void foo (short x, int y, int z) +{ + if (x == 0) + { + bar (y, m); + z = 1; + } + else if (x == 1) + z = 0; + bar (y, m); + bar (z, "%d"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071128-1.c b/gcc/testsuite/gcc.c-torture/compile/20071128-1.c new file mode 100644 index 000000000..14b3f9398 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071128-1.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/34140 */ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +struct S +{ + unsigned int s; +}; +struct T +{ + struct S t[2]; + unsigned int u : 1; +}; + +void +foo (int x, int y, int z) +{ + int i; + struct T t; + + t.u = t.u; + for (i = 0; i < x; i++) + if (z != 1) + t.t[i].s = y || t.u; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071203-1.c b/gcc/testsuite/gcc.c-torture/compile/20071203-1.c new file mode 100644 index 000000000..154b28bc9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071203-1.c @@ -0,0 +1,12 @@ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +struct User { char username[10]; }; + +void +auth_set_username (struct User *user) +{ + char *d; + char ch; + d = user->username + (user->username[0] == '~'); + while ((ch = *d++) != '\0') /* do nothing */ ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071207-1.c b/gcc/testsuite/gcc.c-torture/compile/20071207-1.c new file mode 100644 index 000000000..27b871616 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071207-1.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/34371 */ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +void centerln (int width, int ch, char *s) +{ + unsigned int sidebar; + int i; + char linet1[1000]; + char linet2[100]; + sidebar = (width - __builtin_strlen (s)) / 2; + for (i = 0; i < sidebar; i++) + linet2[i] = ch; + __builtin_strcpy (linet1, linet2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071214-1.c b/gcc/testsuite/gcc.c-torture/compile/20071214-1.c new file mode 100644 index 000000000..f30af9306 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071214-1.c @@ -0,0 +1,15 @@ +typedef __builtin_va_list va_list; +void gftp_config_parse_args (int numargs, char **first, ...) +{ + char **dest = first; + va_list argp; + __builtin_va_start (argp, first); + while (numargs-- > 0) + { + *dest = __builtin_malloc (1); + dest = __builtin_va_arg(argp, char **); + *dest = ((void *)0); + } + __builtin_va_end(argp); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20080114-1.c b/gcc/testsuite/gcc.c-torture/compile/20080114-1.c new file mode 100644 index 000000000..f251c22b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080114-1.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/31944 */ +/* Origin: Aurelien Jarno <aurelien@aurel32.net> */ + +int type; + +void stuck(int res) +{ + if (type == 1) { + if (res == 0) asm volatile(""); + } + else if (type == 0) { + if (res == 0) asm volatile("" : : "i" (0)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080124-1.c b/gcc/testsuite/gcc.c-torture/compile/20080124-1.c new file mode 100644 index 000000000..a20937c29 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080124-1.c @@ -0,0 +1,52 @@ +/* PR middle-end/34934 */ + +#include <stdarg.h> + +typedef struct +{ + int e[1024]; + int f; +} S; + +void foo (long *, va_list); + +void +bar (long *x, S *y, int z, ...) +{ + int i, j; + va_list ap; + va_start (ap, z); + for (j = y->e[i = 1]; i <= y->f; j = y->e[++i]) + { + switch (z) + { + case 1: + if (!(*x & 0x00000020)) + continue; + case 3: + if (!(*x & 0x00000080)) + continue; + case 9: + if (!(*x & 0x04000000)) + continue; + case 4: + if (!(*x & 0x00000200)) + continue; + case 8: + if (!(*x & 0x00100000)) + continue; + case 6: + if (!(*x & 0x00000100)) + continue; + case 7: + if (!(*x & 0x00040000)) + continue; + case 10: + if (!(*x & 0x00000020) + && ((*x & 0x00008000) || (*x & 0x08000000))) + continue; + } + foo (x, ap); + } + va_end (ap); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080419-1.c b/gcc/testsuite/gcc.c-torture/compile/20080419-1.c new file mode 100644 index 000000000..b257fea74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080419-1.c @@ -0,0 +1,6 @@ +extern void *f(); +void dmi_scan_machine(void) { + char *p = f(), *q; + for (q = p; q < p + 10; q++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080613-1.c b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c new file mode 100644 index 000000000..20e387842 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c @@ -0,0 +1,40 @@ +/* PR middle-end/36520 */ +/* Testcase by Richard Guenther <rguenth@gcc.gnu.org> */ + +typedef __SIZE_TYPE__ size_t; +typedef unsigned short int sa_family_t; +struct cmsghdr { + size_t cmsg_len; + __extension__ unsigned char __cmsg_data []; +}; +typedef unsigned int uint32_t; +struct in6_addr { + union { + uint32_t u6_addr32[4]; + } in6_u; +}; +struct sockaddr_in { + sa_family_t sin_family; +}; +struct in6_pktinfo { + struct in6_addr ipi6_addr; +}; +typedef union { + struct sockaddr_in sin; +} sockaddr_any; +static sockaddr_any src_addr; + +inline struct cmsghdr * cmsg_put(struct cmsghdr *cm, int type, void *data, size_t len) +{ + memcpy(((cm)->__cmsg_data), data, len); +} + +int hop_sendmsg(int fd) { + struct cmsghdr *cm; + if (src_addr.sin.sin_family) { + if (src_addr.sin.sin_family == 2) { + struct in6_pktinfo info; + cm = cmsg_put(cm, 50, &info, sizeof(info)); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c new file mode 100644 index 000000000..16def2c8a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c @@ -0,0 +1,17 @@ +/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" "pdp11-*-*" } { "*" } { "" } } */ +struct peakbufStruct { + unsigned int lnum [5000]; + int lscan [5000][4000]; + double lmz [5000][4000]; + double lint [5000][4000]; + int PeaksInBuf; + unsigned char freelists [350000]; + unsigned char freelistl [5000]; + unsigned int LastFreeL; +} peakbuf; +void foo(int); +void findmzROI(int i, int *p_scan) +{ + foo(peakbuf.PeaksInBuf); + __builtin_memmove(p_scan, peakbuf.lscan[i], peakbuf.lnum[i]*sizeof(int)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080628-1.c b/gcc/testsuite/gcc.c-torture/compile/20080628-1.c new file mode 100644 index 000000000..aca4ff827 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080628-1.c @@ -0,0 +1,15 @@ +void f (long double, long double); + +struct s { + char c; + struct s *p; +} *p; + +void +g (void) +{ + long double ld; + p->p->c = 1; + ld = p->p->c; + f (ld, 1.0L); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080704-1.c b/gcc/testsuite/gcc.c-torture/compile/20080704-1.c new file mode 100644 index 000000000..b5e38b4ba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080704-1.c @@ -0,0 +1,43 @@ +/* This code used to crash fold_convert due to PRE + wanting to fold_convert from a REAL_TYPE to an INTEGER_TYPE. */ +typedef unsigned int uint32_t; +union double_union +{ + double d; + uint32_t i[2]; +}; +struct _Jv_reent +{ + int _errno; +}; +_Jv_strtod_r (struct _Jv_reent *ptr, char **se) +{ + int bb2, sign; + double aadj, aadj1, adj; + unsigned long y, z; + union double_union rv, *bs = ((void *) 0), *delta = ((void *) 0); + { + ovfl:ptr->_errno = 34; + { + (((uint32_t) 0xfffffL) | ((uint32_t) 0x100000L) * (1024 + 1023 - 1)); + } + if ((aadj = _Jv_ratio (delta, bs)) <= 2.) + { + { + if (aadj < 2. / 2) + aadj = 1. / 2; + aadj1 = -aadj; + } + } + { + (rv.i[1]) -= 53 * ((uint32_t) 0x100000L); + adj = aadj1 * _Jv_ulp (rv.d); + rv.d += adj; + if (((rv.i[1]) & ((uint32_t) 0x7ff00000L)) >= + ((uint32_t) 0x100000L) * (1024 + 1023 - 53)) + { + goto ovfl; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080721-1.c b/gcc/testsuite/gcc.c-torture/compile/20080721-1.c new file mode 100644 index 000000000..35ef352bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080721-1.c @@ -0,0 +1,15 @@ +void foo(void); +void bar(void); + +int test(int b) +{ + void *p, **q; + if (b) + p = (void *)foo; + else + p = (void *)bar; + q = (void **)p; + if (*q == (void *)0) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080806-1.c b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c new file mode 100644 index 000000000..c54e7397f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c @@ -0,0 +1,41 @@ +/* This used to ICE on s390x due to a reload bug. */ + +#if defined(STACK_SIZE) && (STACK_SIZE < 65536) + #define BYTES 64 +#else + #define BYTES 65400 +#endif + +int gl2; +typedef __SIZE_TYPE__ size_t; + +extern void *memcpy (void *dest, const void *src, size_t n); + +void +f1 () +{ + int i2; + unsigned char bf[BYTES]; + + for (i2 = 0; i2 < 3; i2++) + { + unsigned char *p2 = bf; + unsigned char *p3 = ((void *) 0); + unsigned short ctf2; + + p2 += sizeof (short); + + for (ctf2 = 0; ctf2 < 3; ctf2++) + { + if (ctf2 == 1) + { + unsigned short of = p2 - bf - 6; + unsigned short *ofp = (unsigned short *) &of; + memcpy (p3, ofp, sizeof (short)); + } + + if (gl2 == 1) + p2 += 3; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080812-1.c b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c new file mode 100644 index 000000000..2e4c13a70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c @@ -0,0 +1,21 @@ +/* PR middle-end/37014 */ + +void bar (signed char *); + +void +foo (int x, int y) +{ + int i; + signed char a[123], b[123], c; + for (i = 0; i < 123; i++) + { + int e = y - x; + int d = e < 0 ? -e : e; + c = d < 75; + a[y] = c; + b[y] = c; + y--; + } + bar (b); + bar (a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080820-1.c b/gcc/testsuite/gcc.c-torture/compile/20080820-1.c new file mode 100644 index 000000000..a4d4375ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080820-1.c @@ -0,0 +1,5 @@ +extern unsigned long volatile jiffies; +void do_timer(void) +{ + (*(unsigned long *)&jiffies)++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080903-1.c b/gcc/testsuite/gcc.c-torture/compile/20080903-1.c new file mode 100644 index 000000000..180b926bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080903-1.c @@ -0,0 +1,12 @@ +struct bar { unsigned short length; }; + +int +dummy(void) +{ + char c[4096]; + struct bar *a; + struct bar *b; + + a->length = ((char *) b - c); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080910-1.c b/gcc/testsuite/gcc.c-torture/compile/20080910-1.c new file mode 100644 index 000000000..bf32775d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080910-1.c @@ -0,0 +1,56 @@ +/* This used to crash IRA with -O3 -fPIC. + See PR 37333. */ +struct yy_buffer_state { + int yy_is_interactive; +}; +static struct yy_buffer_state * * yy_buffer_stack = 0; +static int yy_n_chars; +int orafce_sql_yyleng; +unsigned char *yy_c_buf_p = 0; +extern char *orafce_sql_yytext; +static const int yy_ec[256] = { }; +short yy_accept[155], yy_base[193] = { }, yy_def[193] = { }; +short yy_chk[738] = { }; +unsigned char *yy_last_accepting_cpos; +int orafce_sql_yylex (int a) +{ + register int yy_current_state; + unsigned char *yy_cp, *yy_bp; + register int yy_act; + while ( 1 ) { + do { + char yy_c = yy_ec[*yy_cp]; + if ( yy_accept[yy_current_state] ) + yy_last_accepting_cpos = yy_cp; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + yy_current_state = yy_def[yy_current_state]; + } while ( yy_current_state != 154 ); +yy_find_action: + yy_act = yy_accept[yy_current_state]; + *yy_cp = '\0'; + switch ( yy_act ) { + case 2: + *yy_cp = 1; + return 265; + case 24: + case 25: + addlit(orafce_sql_yytext, orafce_sql_yyleng); + case 26: + addlit(orafce_sql_yytext, orafce_sql_yyleng); + case 53: + yy_fatal_error( "flex scanner jammed" ); + break; + case 54: + yy_cp = ++(yy_c_buf_p); + unsigned long n = 0; + if ( yy_buffer_stack[0]->yy_is_interactive ) + for ( ; _IO_getc () != (-1) ; ++n ) + yy_n_chars = n; + if (a == 0) + { + yy_current_state = yy_get_previous_state( ); + goto yy_find_action; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080922-1.c b/gcc/testsuite/gcc.c-torture/compile/20080922-1.c new file mode 100644 index 000000000..853ec4f25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080922-1.c @@ -0,0 +1,29 @@ +typedef struct rtx_def *rtx; +typedef struct rtvec_def *rtvec; +enum rtx_code { PARALLEL, SET }; +union rtunion_def { + rtx rt_rtx; + rtvec rt_rtvec; +}; +typedef union rtunion_def rtunion; +struct rtx_def { + rtunion fld; +}; +struct rtvec_def { + int num_elem; +}; +extern rtx operand; + +rtx peephole2_insns (rtx x0, enum rtx_code code) +{ + switch (code) + { + case SET: + operand = (((x0)->fld).rt_rtx); + return operand; + case PARALLEL: + if ((((((x0)->fld).rt_rtvec))->num_elem) == 2) + return 0; + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080929-1.c b/gcc/testsuite/gcc.c-torture/compile/20080929-1.c new file mode 100644 index 000000000..1aa868ca2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080929-1.c @@ -0,0 +1,39 @@ +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; +enum { + UBI_DYNAMIC_VOLUME = 3, UBI_STATIC_VOLUME = 4, }; +typedef void * libubi_t; +struct ubi_dev_info { + int leb_size; +}; +struct args { + int vol_id; + int vol_type; + long long bytes; + int lebs; + int alignment; + const char *node; + int maxavs; + int devn; +}; +static struct args args = { + .vol_type = UBI_DYNAMIC_VOLUME, .bytes = -1, .lebs = -1, .alignment = 1, .vol_id = (-1), .devn = -1, }; +extern libubi_t libubi_open (int); +extern int ubi_get_dev_info (libubi_t, const char *, struct ubi_dev_info *); +int main(int argc, char * const argv[]) { + int err; + libubi_t libubi; + struct ubi_dev_info dev_info; + libubi = libubi_open(1); + if (!libubi) + return 0; + err = ubi_get_dev_info(libubi, args.node, &dev_info); + if (args.maxavs) { + args.bytes = dev_info.leb_size; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081101-1.c b/gcc/testsuite/gcc.c-torture/compile/20081101-1.c new file mode 100644 index 000000000..0e484d062 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081101-1.c @@ -0,0 +1,12 @@ +int foo (int i, int b) +{ + int mask; + int result; + if (b) + mask = -1; + else + mask = 0; + result = i + 1; + result = result & mask; + return result; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-1.c b/gcc/testsuite/gcc.c-torture/compile/20081108-1.c new file mode 100644 index 000000000..3209a90c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081108-1.c @@ -0,0 +1,11 @@ +/* Test function call with function designator involving VLA + side-effects does not lead to an ICE. */ + +void f (void); +void g (void); + +void +h (int a, void *b) +{ + ((void *)(int (*)[++a])b ? f : g) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-2.c b/gcc/testsuite/gcc.c-torture/compile/20081108-2.c new file mode 100644 index 000000000..2f5a7f64b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081108-2.c @@ -0,0 +1,4 @@ +/* Test boolean conversion as part of returning unsigned value does + not lead to an ICE. */ + +_Bool f(unsigned a) { return a & 1; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-3.c b/gcc/testsuite/gcc.c-torture/compile/20081108-3.c new file mode 100644 index 000000000..12c58ba98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081108-3.c @@ -0,0 +1,4 @@ +/* Test boolean conversion of an overflowing integer return value does + not lead to an ICE. */ + +_Bool f(void) { return __INT_MAX__ + 1; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20081119-1.c b/gcc/testsuite/gcc.c-torture/compile/20081119-1.c new file mode 100644 index 000000000..7402f549b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081119-1.c @@ -0,0 +1,5 @@ +unsigned long long +f (__builtin_va_list ap) +{ + return __builtin_va_arg (ap, unsigned long long); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081203-1.c b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c new file mode 100644 index 000000000..713235ff5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c @@ -0,0 +1,24 @@ +/* PR rtl-optimization/38281 */ +/* Reporter: John Regehr <regehr@cs.utah.edu> */ +/* Testcase by Jakub Jelinek <jakub@redhat.com> */ + +inline unsigned short +foo (unsigned short x, unsigned short y) +{ + if (y == 0) + return x; + return x / y; +} + +unsigned short a, b, c; + +extern int baz (int, int); + +void +bar (void) +{ + int d = 0x3D75D162; + a = foo (b > d, baz (0, 1)); + for (c = 0; c; c = 1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090107-1.c b/gcc/testsuite/gcc.c-torture/compile/20090107-1.c new file mode 100644 index 000000000..b5d4c1a44 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090107-1.c @@ -0,0 +1,25 @@ +/* Verify that we don't ICE by forming invalid addresses for unaligned + doubleword loads (originally for PPC64). */ + +struct a +{ + unsigned int x; + unsigned short y; +} __attribute__((packed)); + +struct b { + struct a rep; + unsigned long long seq; +} __attribute__((packed)); + +struct c { + int x; + struct a a[5460]; + struct b b; +}; + +extern void use_ull(unsigned long long); +extern void f(struct c *i) { + use_ull(i->b.seq); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090114-1.c b/gcc/testsuite/gcc.c-torture/compile/20090114-1.c new file mode 100644 index 000000000..692c96f76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090114-1.c @@ -0,0 +1,44 @@ +typedef struct { + int MbInterlace; + int channel_type; +} InputParameters; +typedef struct { + int type; + int NumberofCodedPFrame; + int NumberofGOP; + int NumberofPPicture; + int FieldControl; + int Frame_Total_Number_MB; + int NumberofCodedMacroBlocks; + int BasicUnit; +} ImageParameters; +extern InputParameters *input; +extern ImageParameters *img; +long T; +void rc_init_pict(int fieldpic) +{ + if(input->MbInterlace) + T = img->Frame_Total_Number_MB; + img->NumberofCodedMacroBlocks=0; + if(input->channel_type==1 + && img->NumberofCodedPFrame==58) + T = 4; + if(fieldpic) + { + switch (img->type) + { + case 0: + if(img->NumberofCodedPFrame>0 + && img->FieldControl==1) + T = 3; + if(img->NumberofPPicture==1) + T = 2; + } + if(img->type==0 + && img->NumberofCodedPFrame>0) + T = 0; + } + if(img->type==0 + && img->FieldControl==1) + T = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090209-1.c b/gcc/testsuite/gcc.c-torture/compile/20090209-1.c new file mode 100644 index 000000000..781a5e8fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090209-1.c @@ -0,0 +1,61 @@ +/* PR middle-end/38981 */ +/* Reporter: Kamaraju Kusumanchi <kamaraju@gmail.com> */ + +struct d_info +{ + int **subs; +}; + +static int * +d_substitution (struct d_info *di, int prefix) +{ + char c; + + c='_'; + + if (c == '_') + { + unsigned int id; + + if (c != '_') + { + do + { + unsigned int new_id; + + if (new_id < id) + return 0; + id = new_id; + } + while (c != '_'); + } + + + + return di->subs[id]; + } + else + { + int verbose; + int code; + int simple_len; + + code=0; + simple_len=0; + verbose=0; + if (! code && prefix) + { + char peek; + peek='A'; + + if (peek == 'C' || peek == 'D') + verbose = 1; + } + + if (verbose) + { + code = simple_len; + } + + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090303-1.c b/gcc/testsuite/gcc.c-torture/compile/20090303-1.c new file mode 100644 index 000000000..18a3d91fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090303-1.c @@ -0,0 +1,20 @@ +/* The array offset became 0x1ffffffffffffffe via a conversion from + signed to unsigned HOST_WIDE_INT, causing an ICE compiling for + Thumb. */ + +int r (unsigned short *); +void s (unsigned short *, unsigned short *); + +int +f (int x) +{ + unsigned short a[1], c[1]; + + if (r (a)) + return x; + + if (c[-1]) + s (a, c); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090303-2.c b/gcc/testsuite/gcc.c-torture/compile/20090303-2.c new file mode 100644 index 000000000..69cee36e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090303-2.c @@ -0,0 +1,20 @@ +/* The array offset became 0x1ffffffffffffffe via a conversion from + signed to unsigned HOST_WIDE_INT, causing an ICE compiling for + Thumb. */ + +int r (unsigned short *); +void s (unsigned short *, unsigned short *); + +int +f (int x) +{ + unsigned short a[1], c[1]; + + if (r (a)) + return x; + + if (c[0x7fffffff]) + s (a, c); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090328-1.c b/gcc/testsuite/gcc.c-torture/compile/20090328-1.c new file mode 100644 index 000000000..10328ad41 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090328-1.c @@ -0,0 +1,17 @@ +union loc { unsigned reg; signed offset; }; +void __frame_state_for (volatile char *state_in, int x) +{ + /* We should move all the loads out of this loop. Right now, we only + move one. It takes two insertions because we insert a cast. */ + union loc fs; + int reg; + for (;;) { + switch (x) { + case 0: + *state_in = fs.reg; + case 1: + *state_in = fs.offset; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20090331-1.c b/gcc/testsuite/gcc.c-torture/compile/20090331-1.c new file mode 100644 index 000000000..2db2ee72e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090331-1.c @@ -0,0 +1,26 @@ +struct re_pattern_buffer { + unsigned char *buffer; + unsigned long int allocated; +}; +void byte_regex_compile (struct re_pattern_buffer *bufp, + unsigned char *begalt, unsigned char *b) +{ + unsigned char *pfrom; + unsigned char *pto; + + while ((unsigned long) (b - bufp->buffer + 3) > bufp->allocated) + { + unsigned char *old_buffer = bufp->buffer; + bufp->allocated <<= 1; + if (old_buffer != bufp->buffer) + { + int incr = bufp->buffer - old_buffer; + b += incr; + } + } + pfrom = b; + pto = b + 3; + while (pfrom != begalt) + *--pto = *--pfrom; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20090401-1.c b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c new file mode 100644 index 000000000..a0058feb2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c @@ -0,0 +1,11 @@ +/* PR rtl-optimization/39588 */ +/* Testcase by Olivier ROUSSEL <olivier.roussel@cril.univ-artois.fr> */ + +#define lit_from_int(in) ((in<0)?(((-in)<<1)|1):(in<<1)) + +void init_clause(int *literals, int size, int *lits) +{ + int i; + for(i=0; i < size; i++) + lits[i] = lit_from_int(literals[i]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090518-1.c b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c new file mode 100644 index 000000000..709504c40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c @@ -0,0 +1,6 @@ +float +foo(int i) +{ + int j = i == 42; + return *(float *)&j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090519-1.c b/gcc/testsuite/gcc.c-torture/compile/20090519-1.c new file mode 100644 index 000000000..54add6b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090519-1.c @@ -0,0 +1,11 @@ +typedef struct { int licensed; } __pmPDUInfo; +void __pmDecodeXtendError (int *); +void do_handshake(void) +{ + __pmPDUInfo *pduinfo; + int challenge; + __pmDecodeXtendError(&challenge); + pduinfo = (__pmPDUInfo *)&challenge; + *pduinfo = *pduinfo; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20090721-1.c b/gcc/testsuite/gcc.c-torture/compile/20090721-1.c new file mode 100644 index 000000000..2122b3405 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090721-1.c @@ -0,0 +1,3 @@ +/* { dg-options "-fno-tree-sra" } */ +union u {double d;long long ll;}; +f(double x, int n){union u v;v.d=x;if(n>=0){v.ll<<=63;}else{v.ll-=1<<-n;v.ll>>=-n;}return v.ll;} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090907-1.c b/gcc/testsuite/gcc.c-torture/compile/20090907-1.c new file mode 100644 index 000000000..907574c42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090907-1.c @@ -0,0 +1,84 @@ +struct platform_device; +typedef unsigned long __kernel_size_t; +typedef unsigned short __u16; +typedef unsigned int __u32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef __kernel_size_t size_t; +typedef __u32 uint32_t; +static inline __attribute__ ((always_inline)) +uint32_t __attribute__ ((pure)) bfin_dspid (void) +{ + return ( { + uint32_t __v; __v;} + ); +} +struct list_head { + struct list_head *next, *prev; +}; +struct page { + union { + }; + struct list_head lru; +}; +struct device_driver { + const char *name; + struct module *owner; +}; +struct fb_info { + struct device *dev; +}; +struct platform_driver { + int (*probe) (struct platform_device *); + int (*remove) (struct platform_device *); + struct device_driver driver; +}; +struct firmware { + size_t size; + const u8 *data; +}; +struct metronomefb_par { + struct fb_info *info; +}; +struct waveform_hdr { + u8 trc; +}; +static u8 calc_cksum (int start, int end, u8 * mem) +{ + u8 tmp = 0; + int i; + for (i = start; i < end; i++) + tmp += mem[i]; + return tmp; +} +extern struct waveform_hdr *wfm_hdr; +extern int wmta; + +static int +load_waveform (u8 * mem, size_t size, int m, int t, struct metronomefb_par *par) +{ + int tta; + int trn = 0; + int i; + u8 cksum; + int cksum_idx; + struct device *dev = par->info->dev; + for (i = 0; i <= sizeof (*wfm_hdr) + wfm_hdr->trc; i++) { + if (mem[i] > t) { + trn = i - sizeof (*wfm_hdr) - 1; + } + } + tta = * (mem + wmta + m * 4) & 0x00FFFFFF; + cksum_idx = tta + trn * 4 + 3; + cksum = calc_cksum (cksum_idx - 3, cksum_idx, mem); + if (cksum != mem[cksum_idx]) { + abort(); + } +} +extern struct firmware *fw_entry; +extern struct metronomefb_par *par; + +int metronomefb_probe (struct platform_device *dev) +{ + return load_waveform ((u8 *) fw_entry->data, fw_entry->size, 3, 31, par); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090917-1.c b/gcc/testsuite/gcc.c-torture/compile/20090917-1.c new file mode 100644 index 000000000..2b8c37148 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090917-1.c @@ -0,0 +1,55 @@ +typedef int *loop_p; +typedef struct VEC_loop_p_base +{ + unsigned num; + loop_p vec[1]; +} +VEC_loop_p_base; + +__inline__ int +VEC_loop_p_base_iterate (const VEC_loop_p_base * vec_, unsigned ix_, + loop_p * ptr) +{ + if (vec_ && ix_ < vec_->num) + { + *ptr = vec_->vec[ix_]; + return 1; + } + else + { + return 0; + } +} + +typedef struct VEC_loop_p_heap +{ + VEC_loop_p_base base; +} +VEC_loop_p_heap; + + +static __inline__ int +am_vector_index_for_loop (VEC_loop_p_heap * loop_nest, int loop_num) +{ + int i; + loop_p l; + + for (i = 0; + VEC_loop_p_base_iterate ((loop_nest) ? &(loop_nest)->base : 0, i, + &(l)); i++) + if (l == loop_num) + return i; + + __builtin_unreachable (); +} + +unsigned char +build_access_matrix (unsigned max) +{ + unsigned i; + for (i = 0; i < max; i++) + { + if (am_vector_index_for_loop (foo (), 0)) + return 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20091215-1.c b/gcc/testsuite/gcc.c-torture/compile/20091215-1.c new file mode 100644 index 000000000..7862e2fb0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20091215-1.c @@ -0,0 +1,15 @@ +void bar (); + +void +foo (void *x, short y) +{ + bar (x, y + 1); +} + +void +bar (x, y) + void *x; + char *y; +{ + baz (y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100609-1.c b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c new file mode 100644 index 000000000..8e1175faa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c @@ -0,0 +1,8 @@ +extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base); +int find_reloads (int i, char *p) +{ + int c; + while ((c = *p++)) + return strtoul (p - 1, &p, 10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100907.c b/gcc/testsuite/gcc.c-torture/compile/20100907.c new file mode 100644 index 000000000..2e6cfb9ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100907.c @@ -0,0 +1,9 @@ +struct a {int a,b;}; +const static struct a a[1]={{1,2}}; +struct a b,c; +t() +{ + int idx = 0; + b=a[idx]; + c=a[idx]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100915-1.c b/gcc/testsuite/gcc.c-torture/compile/20100915-1.c new file mode 100644 index 000000000..04f6ab0fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100915-1.c @@ -0,0 +1,82 @@ +/* PR rtl-optimization/45593 */ +/* Testcase by Arnaud Lacombe <lacombar@gmail.com> */ + +typedef unsigned int __u32; +typedef __u32 __be32; +static inline __attribute__((always_inline)) int __attribute__((__cold__)) printk(const char *s, ...) { return 0; } +typedef struct journal_s journal_t; +typedef struct journal_header_s +{ + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; +} journal_header_t; +typedef struct journal_superblock_s +{ + journal_header_t s_header; + __be32 s_blocksize; + __be32 s_maxlen; +} journal_superblock_t; +struct journal_s +{ + struct buffer_head *j_sb_buffer; + journal_superblock_t *j_superblock; + int j_format_version; + int j_blocksize; + unsigned int j_maxlen; +}; +static void journal_fail_superblock (journal_t *journal) +{ + journal->j_sb_buffer = ((void *)0); +} +static int journal_get_superblock(journal_t *journal) +{ + struct buffer_head *bh; + journal_superblock_t *sb; + int err = -100; + bh = journal->j_sb_buffer; + if (!buffer_uptodate(bh)) { + if (!buffer_uptodate(bh)) { + printk ("JBD: IO error reading journal superblock\n"); + goto out; + } + } + err = -101; + if (sb->s_header.h_magic != (( __be32)(__u32)(0)) || + sb->s_blocksize != (( __be32)(__u32)(journal->j_blocksize))) { + printk("JBD: no valid journal superblock found\n"); + goto out; + } + switch((( __u32)(__be32)(sb->s_header.h_blocktype))) { + case 0: + case 1: + break; + default: + goto out; + } + if ((( __u32)(__be32)(sb->s_maxlen)) < journal->j_maxlen) + journal->j_maxlen = (( __u32)(__be32)(sb->s_maxlen)); + else if ((( __u32)(__be32)(sb->s_maxlen)) > journal->j_maxlen) { + printk ("JBD: journal file too short\n"); + goto out; + } + return 0; +out: + journal_fail_superblock(journal); + return err; +} +static int load_superblock(journal_t *journal) +{ + journal_get_superblock(journal); + return 0; +} +int jbd2_journal_update_format (journal_t *journal) +{ + journal_get_superblock(journal); + return 0; +} +int jbd2_journal_wipe(journal_t *journal, int write) +{ + load_superblock(journal); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20101217-1.c b/gcc/testsuite/gcc.c-torture/compile/20101217-1.c new file mode 100644 index 000000000..c4eef0ed4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20101217-1.c @@ -0,0 +1,36 @@ +/* Testcase provided by HUAWEI. */ +#include <stdio.h> +int main() +{ + int cur_k; + int cur_j=0; + int cur_i=28; + unsigned char temp_data[8]; + unsigned int Data_Size=20; + + for (cur_k=0;cur_j<7;cur_j++,cur_i++) { + if (cur_j%2==0) { + temp_data[cur_k++]=0; + } + if (cur_k==7) { + for (;cur_k>0;cur_k--) { + if (cur_k>2) { + if ((temp_data[7-cur_k]=='n' || temp_data[7-cur_k]=='N' ) && (temp_data[7-cur_k+1]=='a' || temp_data[7-cur_k+1]=='A' )) { + break; + } + } + if (cur_k==1) { + if (temp_data[7-cur_k]=='n' || temp_data[7-cur_k]=='N' ) { + break; + } + } + } + if (cur_k==7) { + } else { + if (cur_k>0) + printf("dfjk"); + } + } + } +return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110126-1.c b/gcc/testsuite/gcc.c-torture/compile/20110126-1.c new file mode 100644 index 000000000..c55e0c205 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110126-1.c @@ -0,0 +1,18 @@ +/* PR rtl-optimization/44469 */ +/* Testcase by Siarhei Siamashka <siarhei.siamashka@gmail.com> */ + +int a (int *t, const char *p) +{ + if (*t == 0) + { + } + else if (*t == 1) + { + p = (const char *)t; + } + else + __builtin_unreachable(); + if (p[0]) + return 0; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110131-1.c b/gcc/testsuite/gcc.c-torture/compile/20110131-1.c new file mode 100644 index 000000000..8ce68de4b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110131-1.c @@ -0,0 +1,38 @@ +/* PR rtl-optimization/44031 */ +/* Testcase by John Regehr <regehr@cs.utah.edu> */ + +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + +static uint32_t +safe_add_func_uint32_t_u_u (uint32_t ui1, uint32_t ui2) +{ + return ui1 + ui2; +} + +static uint64_t +safe_div_func_uint64_t_u_u (uint64_t ui1, uint32_t ui2) +{ + return ui2 ? : (ui1 / ui2); +} + +uint8_t g_55; +uint8_t *g_73 = &g_55; +uint8_t **g_332 = &g_73; + +int func_38(uint8_t *,int); +int func_8(int); + +int int321 (void) +{ + uint8_t l_26[4]; + uint8_t *l_238 = &l_26[2]; + uint8_t l_400; + l_400 &= + func_38 (&l_26[3], + safe_add_func_uint32_t_u_u (safe_div_func_uint64_t_u_u + (1, **g_332), + *l_238) >= *l_238 < func_8 (0)), 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110906-1.c b/gcc/testsuite/gcc.c-torture/compile/20110906-1.c new file mode 100644 index 000000000..50ea9e241 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110906-1.c @@ -0,0 +1,22 @@ +/* PR middle-end/50266 */ +/* Testcase by <bero@arklinux.org> */ + +struct a { + unsigned int a; + unsigned int b; +}; + +struct a *const p = (struct a *)0x4A004100; + +void foo(void) +{ + unsigned int i = 0; + unsigned int *const x[] = { + &p->a, + &p->b, + 0 + }; + + (*(volatile unsigned int *)((x[i])) + = (unsigned int)((unsigned int)((*(volatile unsigned int *)(x[i]))))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110913-1.c b/gcc/testsuite/gcc.c-torture/compile/20110913-1.c new file mode 100644 index 000000000..e435a14b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110913-1.c @@ -0,0 +1,26 @@ +struct ieee754_double { + double d; +}; +extern const float __exp_deltatable[178]; +float __ieee754_expf (float x) +{ + static const float himark = 88.72283935546875; + static const float lomark = -103.972084045410; + if (__builtin_isless(x, himark) && __builtin_isgreater(x, lomark)) + { + int tval; + double x22, t, result, dx; + float delta; + struct ieee754_double ex2_u; + dx -= t; + tval = (int) (t * 512.0); + if (t >= 0) + delta = - __exp_deltatable[tval]; + else + delta = __exp_deltatable[-tval]; + x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; + result = x22 * ex2_u.d + ex2_u.d; + return (float) result; + } + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20121107-1.c b/gcc/testsuite/gcc.c-torture/compile/20121107-1.c new file mode 100644 index 000000000..a86206702 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20121107-1.c @@ -0,0 +1,14 @@ +/* PR middle-end/55219 */ +/* Testcase by Markus Trippelsdorf <markus@trippelsdorf.de> */ + +int x, c, d, e, f, g, h, i; +double j; +const int k; +const enum { B } a; +void +fn1 (void) +{ + h = (g ? c : g ? f : g ? e : g ? i : g ? f : g ? e : g ? d : x) + + (a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a + ? j : a ? : 0 ? : a ? : a ? : a ? : a ? : a ? : a ? k : a ? : x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900116-1.c b/gcc/testsuite/gcc.c-torture/compile/900116-1.c new file mode 100644 index 000000000..37c7eb789 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900116-1.c @@ -0,0 +1,14 @@ +struct st {char a, b, c, d; } + +zloop (struct st *s, int *p, int *q) +{ + int i; + struct st ss; + + for (i = 0; i < 100; i++) + { + ss = s[i]; + p[i] = ss.c; + q[i] = ss.b; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900216-1.c b/gcc/testsuite/gcc.c-torture/compile/900216-1.c new file mode 100644 index 000000000..8a4bfb74e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900216-1.c @@ -0,0 +1,9 @@ +foo (p, a, b) + unsigned short *p; +{ + unsigned int x; + + x = p[0]; + + return (x == 134U); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900313-1.c b/gcc/testsuite/gcc.c-torture/compile/900313-1.c new file mode 100644 index 000000000..f2bc40d72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900313-1.c @@ -0,0 +1,172 @@ +main () +{ + char *a; + foo (alloca (10000)); + foo (alloca (100000)); + foo (alloca ((int) &main)); +} + +many_par (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) +{ + char *x; + int aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa; + + aa = bar (); + ba = bar (); + ca = bar (); + da = bar (); + ea = bar (); + fa = bar (); + ga = bar (); + ha = bar (); + ia = bar (); + ja = bar (); + ka = bar (); + la = bar (); + ma = bar (); + na = bar (); + oa = bar (); + pa = bar (); + foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, + da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa); + +} + +foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, + da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa) +{ + int ab, bb, cb, db, eb, fb, gb, hb, ib, jb, kb, lb, mb, nb, ob, pb; + int qb, rb, sb, tb, ub, vb, xb, yb; + + ab = bar (); + bb = bar (); + cb = bar (); + db = bar (); + eb = bar (); + fb = bar (); + gb = bar (); + hb = bar (); + ib = bar (); + jb = bar (); + kb = bar (); + lb = bar (); + mb = bar (); + nb = bar (); + ob = bar (); + pb = bar (); + qb = bar (); + rb = bar (); + sb = bar (); + tb = bar (); + ub = bar (); + vb = bar (); + xb = bar (); + yb = bar (); + + boofar (a); + boofar (b); + boofar (c); + boofar (d); + boofar (e); + boofar (f); + boofar (g); + boofar (h); + boofar (i); + boofar (j); + boofar (k); + boofar (l); + boofar (m); + boofar (n); + boofar (o); + boofar (p); + boofar (aa); + boofar (ba); + boofar (ca); + boofar (da); + boofar (ea); + boofar (fa); + boofar (ga); + boofar (ha); + boofar (ia); + boofar (ja); + boofar (ka); + boofar (la); + boofar (ma); + boofar (na); + boofar (oa); + boofar (pa); + + boofar (ab); + boofar (bb); + boofar (cb); + boofar (db); + boofar (eb); + boofar (fb); + boofar (gb); + boofar (hb); + boofar (ib); + boofar (jb); + boofar (kb); + boofar (lb); + boofar (mb); + boofar (nb); + boofar (ob); + boofar (pb); + + boofar (a); + boofar (b); + boofar (c); + boofar (d); + boofar (e); + boofar (f); + boofar (g); + boofar (h); + boofar (i); + boofar (j); + boofar (k); + boofar (l); + boofar (m); + boofar (n); + boofar (o); + boofar (p); + boofar (aa); + boofar (ba); + boofar (ca); + boofar (da); + boofar (ea); + boofar (fa); + boofar (ga); + boofar (ha); + boofar (ia); + boofar (ja); + boofar (ka); + boofar (la); + boofar (ma); + boofar (na); + boofar (oa); + boofar (pa); + + boofar (ab); + boofar (bb); + boofar (cb); + boofar (db); + boofar (eb); + boofar (fb); + boofar (gb); + boofar (hb); + boofar (ib); + boofar (jb); + boofar (kb); + boofar (lb); + boofar (mb); + boofar (nb); + boofar (ob); + boofar (pb); + +} + +test_exit_ignore_stack () +{ + foobar (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900407-1.c b/gcc/testsuite/gcc.c-torture/compile/900407-1.c new file mode 100644 index 000000000..fdf47791c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900407-1.c @@ -0,0 +1,10 @@ +foo (a, b, p) + int *p; +{ + int c; + p[1] = a + 0x1000; + c = b + 0xffff0000; + if ((b + 0xffff0000) == 0) + c++; + p[2] = c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900516-1.c b/gcc/testsuite/gcc.c-torture/compile/900516-1.c new file mode 100644 index 000000000..69e961447 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900516-1.c @@ -0,0 +1 @@ +f(c){return!(c?2.0:1.0);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920301-1.c b/gcc/testsuite/gcc.c-torture/compile/920301-1.c new file mode 100644 index 000000000..c4d663eb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920301-1.c @@ -0,0 +1,4 @@ +#ifndef NO_LABEL_VALUES +f(){static void*t[]={&&x};x:;} +#endif +g(){static unsigned p[5];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-1.c b/gcc/testsuite/gcc.c-torture/compile/920409-1.c new file mode 100644 index 000000000..b96ec53d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920409-1.c @@ -0,0 +1 @@ +x(){int y;y>0.0?y:y-1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-2.c b/gcc/testsuite/gcc.c-torture/compile/920409-2.c new file mode 100644 index 000000000..ef2bdb8b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920409-2.c @@ -0,0 +1,2 @@ +double x(){int x1,x2;double v; +if(((long)(x1-x2))<1)return -1.0;v=t(v);v=y(1,v>0.0?(int)v:((int)v-1));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-1.c b/gcc/testsuite/gcc.c-torture/compile/920410-1.c new file mode 100644 index 000000000..4bfa7a665 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920410-1.c @@ -0,0 +1,30 @@ +int alloc_float(f) + float f; +{ union + { + float f; + int i; + } + u; + u.f=f; + return u.i&~1; +} + +float c_float(int obj) +{ union + { + float f; + int i; + } u; + + u.i=obj; + return u.f; +} + +main() +{ int x=alloc_float(1.2); + int y=alloc_float(5.7); + int z=alloc_float(c_float(x)*c_float(y)); + + printf("%g\n",(double)c_float(z)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-2.c b/gcc/testsuite/gcc.c-torture/compile/920410-2.c new file mode 100644 index 000000000..958aae9cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920410-2.c @@ -0,0 +1,12 @@ +joe() +{ + int j; + + while( 1 ) + { + for( j = 0; j < 4; j++ ) + ; + for( j = 0; j < 4; j++ ) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920411-2.c b/gcc/testsuite/gcc.c-torture/compile/920411-2.c new file mode 100644 index 000000000..0cc13c843 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920411-2.c @@ -0,0 +1 @@ +x(){int n;double x;n=x<1?n:n+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920413-1.c b/gcc/testsuite/gcc.c-torture/compile/920413-1.c new file mode 100644 index 000000000..45b5fc5d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920413-1.c @@ -0,0 +1,2 @@ +union u {double d;long long ll;}; +f(double x, int n){union u v;v.d=x;if(n>=0){v.ll<<=63;}else{v.ll+=1<<-n;v.ll>>=-n;}return v.ll;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920415-1.c b/gcc/testsuite/gcc.c-torture/compile/920415-1.c new file mode 100644 index 000000000..1636adeaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920415-1.c @@ -0,0 +1,20 @@ +extern void abort (void); +extern void exit (int); + +#ifndef NO_LABEL_VALUES +f () +{ + __label__ l; + void *x() + { + return &&l; + } + goto *x (); + abort (); + return; + l: + exit (0); +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-1.c b/gcc/testsuite/gcc.c-torture/compile/920428-1.c new file mode 100644 index 000000000..fdc478a38 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-1.c @@ -0,0 +1 @@ +x(){char*q;return(long)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 new file mode 100644 index 000000000..f313b3298 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-2.c @@ -0,0 +1,531 @@ +double sin(double x); +double cos(double x); +double tan(double x); +double asin(double x); +double acos(double x); +double atan(double x); +double atan2(double y, double x); +double sinh(double x); +double cosh(double x); +double tanh(double x); +double exp(double x); +double expm1(double x); +double log(double x); +double log10(double x); +double log1p(double x); +double pow(double x, double y); +double sqrt(double x); +double cbrt(double x); +double ceil(double x); +double floor(double x); +double fabs(double x); +double frexp(double value, int *eptr); +double ldexp(double value, int exp); +double modf(double value, double *iptr); +double erf(double x); +double erfc(double x); +double atof(const char *nptr); +double hypot(double x, double y); +double lgamma(double x); +double j0(double x); +double j1(double x); +double jn(int n, double x); +double y0(double x); +double y1(double x); +double yn(int n, double x); +extern struct _iobuf { + int _cnt; + char *_ptr; + char *_base; + int _bufsiz; + short _flag; + char _file; +} _iob[]; +typedef __SIZE_TYPE__ size_t; +typedef char *va_list; +struct _iobuf *fopen(const char *filename, const char *type); +struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream); +struct _iobuf *fdopen(int fildes, const char *type); +struct _iobuf *popen(const char *command, const char *type); +int pclose(struct _iobuf *stream); +int fflush(struct _iobuf *stream); +int fclose(struct _iobuf *stream); +int remove(const char *path); +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; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort_; +typedef struct _physadr { int r[1]; } *physadr; +typedef struct label_t { + int val[11]; +} label_t; +typedef struct _quad { long val[2]; } quad; +typedef long daddr_t; +typedef char * caddr_t; +typedef u_long ino_t; +typedef long swblk_t; +typedef long time_t; +typedef short dev_t; +typedef long off_t; +typedef u_short uid_t; +typedef u_short gid_t; +typedef signed char prio_t; +typedef long fd_mask; +typedef struct fd_set { + fd_mask fds_bits[(((256 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ]; +} fd_set; +typedef struct qhdr { + struct qhdr *link, *rlink; +} *queue_t; +typedef char *ptr_ord_t; +typedef double floatp; +typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name ); +typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name ); +extern struct _iobuf *gs_out; +typedef struct gs_point_s { + double x, y; +} gs_point; +typedef struct gs_int_point_s { + int x, y; +} gs_int_point; +typedef struct gs_rect_s { + gs_point p, q; +} gs_rect; +typedef struct gs_int_rect_s { + gs_int_point p, q; +} gs_int_rect; +typedef struct gs_state_s gs_state; +typedef struct { + proc_alloc_t alloc; + proc_free_t free; +} gs_memory_procs; +char *gs_malloc(uint, uint, const char * ); +void gs_free(char *, uint, uint, const char * ); +extern char gs_debug[128]; +extern int gs_log_error(int, const char *, int ); +typedef long fixed; +typedef struct gs_fixed_point_s { + fixed x, y; +} gs_fixed_point; +typedef struct gs_fixed_rect_s { + gs_fixed_point p, q; +} gs_fixed_rect; +typedef struct gs_matrix_s { + long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; +} gs_matrix; +void gs_make_identity(gs_matrix * ); +int gs_make_translation(floatp, floatp, gs_matrix * ), + gs_make_scaling(floatp, floatp, gs_matrix * ), + gs_make_rotation(floatp, gs_matrix * ); +int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ), + gs_matrix_invert(const gs_matrix *, gs_matrix * ), + gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * ); +int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ), + gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), + gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ), + gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), + gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * ); +typedef struct gs_matrix_fixed_s { + long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; + fixed tx_fixed, ty_fixed; +} gs_matrix_fixed; +extern void gs_update_matrix_fixed(gs_matrix_fixed * ); +int gs_point_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ), + gs_distance_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ); +typedef struct { + long xx, xy, yx, yy; + int skewed; + int shift; + int max_bits; + fixed round; +} fixed_coeff; + +typedef enum { + gs_cap_butt = 0, + gs_cap_round = 1, + gs_cap_square = 2 +} gs_line_cap; +typedef enum { + gs_join_miter = 0, + gs_join_round = 1, + gs_join_bevel = 2 +} gs_line_join; +gs_state *gs_state_alloc(proc_alloc_t, proc_free_t ); +int gs_state_free(gs_state * ); +int gs_gsave(gs_state * ), + gs_grestore(gs_state * ), + gs_grestoreall(gs_state * ); +gs_state *gs_gstate(gs_state * ); +int gs_currentgstate(gs_state * , const gs_state * ), + gs_setgstate(gs_state * , const gs_state * ); +gs_state *gs_state_swap_saved(gs_state *, gs_state * ); +void gs_state_swap(gs_state *, gs_state * ); +int gs_initgraphics(gs_state * ); +typedef struct gx_device_s gx_device; +int gs_flushpage(gs_state * ); +int gs_copypage(gs_state * ); +int gs_output_page(gs_state *, int, int ); +int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint * ); +gx_device * gs_getdevice(int ); +int gs_copydevice(gx_device **, gx_device *, proc_alloc_t ); +int gs_makeimagedevice(gx_device **, gs_matrix *, uint, uint, byte *, int, proc_alloc_t ); +void gs_nulldevice(gs_state * ); +int gs_setdevice(gs_state *, gx_device * ); +gx_device * gs_currentdevice(gs_state * ); +const char * gs_devicename(gx_device * ); +void gs_deviceinitialmatrix(gx_device *, gs_matrix * ); +int gs_closedevice(gx_device * ); +int gs_setlinewidth(gs_state *, floatp ); +float gs_currentlinewidth(const gs_state * ); +int gs_setlinecap(gs_state *, gs_line_cap ); +gs_line_cap gs_currentlinecap(const gs_state * ); +int gs_setlinejoin(gs_state *, gs_line_join ); +gs_line_join gs_currentlinejoin(const gs_state * ); +int gs_setmiterlimit(gs_state *, floatp ); +float gs_currentmiterlimit(const gs_state * ); +int gs_setdash(gs_state *, const float *, uint, floatp ); +uint gs_currentdash_length(const gs_state * ); +int gs_currentdash_pattern(const gs_state *, float * ); +float gs_currentdash_offset(const gs_state * ); +int gs_setflat(gs_state *, floatp ); +float gs_currentflat(const gs_state * ); +int gs_setstrokeadjust(gs_state *, int ); +int gs_currentstrokeadjust(const gs_state * ); +typedef enum { + gs_color_space_DeviceGray = 0, + gs_color_space_DeviceRGB, + gs_color_space_DeviceCMYK +} gs_color_space; +typedef struct gs_color_s gs_color; +extern const uint gs_color_sizeof; +int gs_setgray(gs_state *, floatp ); +float gs_currentgray(gs_state * ); +int gs_sethsbcolor(gs_state *, floatp, floatp, floatp ), + gs_currenthsbcolor(gs_state *, float [3] ), + gs_setrgbcolor(gs_state *, floatp, floatp, floatp ), + gs_currentrgbcolor(gs_state *, float [3] ); +int gs_currentcolorspace(gs_state *, gs_color_space * ); +typedef float (*gs_transfer_proc)(gs_state *, floatp ); +int gs_settransfer(gs_state *, gs_transfer_proc ), + gs_settransfer_remap(gs_state *, gs_transfer_proc, int ); +gs_transfer_proc gs_currenttransfer(gs_state * ); +int gs_setcolortransfer(gs_state *, gs_transfer_proc , + gs_transfer_proc , gs_transfer_proc , + gs_transfer_proc ), + gs_setcolortransfer_remap(gs_state *, gs_transfer_proc , + gs_transfer_proc , gs_transfer_proc , + gs_transfer_proc , int ); +void gs_currentcolortransfer(gs_state *, gs_transfer_proc [4] ); +int gs_setscreen(gs_state *, floatp, floatp, float (*)(floatp, floatp ) ); +int gs_currentscreen(gs_state *, float *, float *, float (**)(floatp, floatp ) ); +int gs_sethalftonephase(gs_state *, int, int ); +int gs_currenthalftonephase(gs_state *, gs_int_point * ); +typedef struct gs_screen_enum_s gs_screen_enum; +extern const uint gs_screen_enum_sizeof; +int gs_screen_init(gs_screen_enum *, gs_state *, floatp, floatp ); +int gs_screen_currentpoint(gs_screen_enum *, gs_point * ); +int gs_screen_next(gs_screen_enum *, floatp ); +struct gs_state_s { + gs_state *saved; + gs_memory_procs memory_procs; + gs_matrix_fixed ctm; + gs_matrix ctm_inverse; + int inverse_valid; + struct gx_path_s *path; + struct gx_clip_path_s *clip_path; + int clip_rule; + struct line_params_s *line_params; + struct halftone_params_s *halftone; + float (*ht_proc)(floatp, floatp ); + gs_int_point ht_phase; + gs_int_point phase_mod; + struct gs_color_s *color; + struct gx_device_color_s *dev_color; + struct gx_transfer_s *transfer; + struct gs_font_s *font; + gs_matrix char_tm; + int char_tm_valid; + byte in_cachedevice; + byte in_charpath; + + + + + int level; + float flatness; + int stroke_adjust; + struct device_s *device; + int device_is_shared; + +}; +typedef unsigned long gx_bitmap_id; +typedef struct gx_bitmap_s { + byte *data; + int raster; + gs_int_point size; + gx_bitmap_id id; + ushort rep_width, rep_height; +} gx_bitmap; +typedef unsigned long gx_color_index; +typedef unsigned short gx_color_value; +typedef struct gx_device_color_info_s { + int num_components; + + int depth; + gx_color_value max_gray; + gx_color_value max_rgb; + + gx_color_value dither_gray; + gx_color_value dither_rgb; + +} gx_device_color_info; +typedef struct gx_device_procs_s gx_device_procs; +struct gx_device_s { + int params_size; gx_device_procs *procs; const char *dname; int width; int height; float x_pixels_per_inch; float y_pixels_per_inch; float l_margin, b_margin, r_margin, t_margin; gx_device_color_info color_info; int is_open; +}; +typedef struct gs_prop_item_s gs_prop_item; +struct gx_device_procs_s { + int (*open_device)(gx_device *dev ); + void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat ); + int (*sync_output)(gx_device *dev ); + int (*output_page)(gx_device *dev, int num_copies, int flush ); + int (*close_device)(gx_device *dev ); + gx_color_index (*map_rgb_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); + int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); + int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color ); + int (*tile_rectangle)(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); + int (*copy_mono)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1 ); + int (*copy_color)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); + int (*draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); + int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); + int (*get_props)(gx_device *dev, gs_prop_item *plist ); + + int (*put_props)(gx_device *dev, gs_prop_item *plist, int count ); + +}; +extern unsigned int gx_device_bytes_per_scan_line(gx_device *dev, int pad_to_word ); +int gx_default_open_device(gx_device *dev ); +void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat ); +int gx_default_sync_output(gx_device *dev ); +int gx_default_output_page(gx_device *dev, int num_copies, int flush ); +int gx_default_close_device(gx_device *dev ); +gx_color_index gx_default_map_rgb_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); +int gx_default_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); +int gx_default_tile_rectangle(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); +int gx_default_copy_color(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); +int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); +int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); +int gx_default_get_props(gx_device *dev, gs_prop_item *plist ); +int gx_default_put_props(gx_device *dev, gs_prop_item *plist, int count ); +typedef struct device_s { + gx_device *info; + int is_band_device; + gx_color_index white, black; +} device; +int gs_initmatrix(gs_state * ), + gs_defaultmatrix(const gs_state *, gs_matrix * ), + gs_currentmatrix(const gs_state *, gs_matrix * ), + gs_setmatrix(gs_state *, const gs_matrix * ), + gs_translate(gs_state *, floatp, floatp ), + gs_scale(gs_state *, floatp, floatp ), + gs_rotate(gs_state *, floatp ), + gs_concat(gs_state *, const gs_matrix * ); +int gs_transform(gs_state *, floatp, floatp, gs_point * ), + gs_dtransform(gs_state *, floatp, floatp, gs_point * ), + gs_itransform(gs_state *, floatp, floatp, gs_point * ), + gs_idtransform(gs_state *, floatp, floatp, gs_point * ); +static int +ctm_set_inverse(gs_state *pgs) +{ int code = gs_matrix_invert(&*(gs_matrix *)&(pgs)->ctm , &pgs->ctm_inverse); + 0; + if ( code < 0 ) return code; + pgs->inverse_valid = 1; + return 0; +} +void +gs_update_matrix_fixed(gs_matrix_fixed *pmat) +{ (*pmat). tx = ((float)(((*pmat). tx_fixed = ((fixed)(((*pmat). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (*pmat). ty = ((float)(((*pmat). ty_fixed = ((fixed)(((*pmat). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))); +} +int +gs_initmatrix(gs_state *pgs) +{ gx_device *dev = pgs->device->info; + (*dev->procs->get_initial_matrix)(dev, &*(gs_matrix *)&(pgs)->ctm ); + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_defaultmatrix(const gs_state *pgs, gs_matrix *pmat) +{ gx_device *dev = pgs->device->info; + (*dev->procs->get_initial_matrix)(dev, pmat); + return 0; +} +int +gs_currentmatrix(const gs_state *pgs, gs_matrix *pmat) +{ *pmat = *(gs_matrix *)&(pgs)->ctm; + return 0; +} +int +gs_setmatrix(gs_state *pgs, const gs_matrix *pmat) +{ *(gs_matrix *)&(pgs)->ctm = *pmat; + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_translate(gs_state *pgs, floatp dx, floatp dy) +{ gs_point pt; + int code; + if ( (code = gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , &pt)) < 0 ) + return code; + pgs->ctm.tx += pt.x; + pgs->ctm.ty += pt.y; + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_scale(gs_state *pgs, floatp sx, floatp sy) +{ pgs->ctm.xx *= sx; + pgs->ctm.xy *= sx; + pgs->ctm.yx *= sy; + pgs->ctm.yy *= sy; + pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_rotate(gs_state *pgs, floatp ang) +{ int code = gs_matrix_rotate(&*(gs_matrix *)&(pgs)->ctm , ang, &*(gs_matrix *)&(pgs)->ctm ); + pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return code; +} +int +gs_concat(gs_state *pgs, const gs_matrix *pmat) +{ int code = gs_matrix_multiply(pmat, &*(gs_matrix *)&(pgs)->ctm , &*(gs_matrix *)&(pgs)->ctm ); + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return code; +} +int +gs_transform(gs_state *pgs, floatp x, floatp y, gs_point *pt) +{ return gs_point_transform(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); +} +int +gs_dtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) +{ return gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , pt); +} +int +gs_itransform(gs_state *pgs, floatp x, floatp y, gs_point *pt) +{ + + if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) + { return gs_point_transform_inverse(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); + } + else + { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; + return gs_point_transform(x, y, &pgs->ctm_inverse, pt); + } +} +int +gs_idtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) +{ + + if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) + { return gs_distance_transform_inverse(dx, dy, + &*(gs_matrix *)&(pgs)->ctm , pt); + } + else + { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; + return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt); + } +} +int +gs_translate_to_fixed(register gs_state *pgs, fixed px, fixed py) +{ pgs->ctm.tx = ((float)((pgs->ctm.tx_fixed = px)*(1.0/(1<<12 ) ))); + pgs->ctm.ty = ((float)((pgs->ctm.ty_fixed = py)*(1.0/(1<<12 ) ))); + pgs->inverse_valid = 0; + pgs->char_tm_valid = 1; + return 0; +} +int +gx_matrix_to_fixed_coeff(const gs_matrix *pmat, register fixed_coeff *pfc, + int max_bits) +{ gs_matrix ctm; + int scale = -10000; + int expt, shift; + ctm = *pmat; + pfc->skewed = 0; + if ( !((*(long *)(&(ctm.xx)) << 1) == 0) ) + { (void)frexp(ctm.xx, &scale); + } + if ( !((*(long *)(&(ctm.xy)) << 1) == 0) ) + { (void)frexp(ctm.xy, &expt); + if ( expt > scale ) scale = expt; + pfc->skewed = 1; + } + if ( !((*(long *)(&(ctm.yx)) << 1) == 0) ) + { (void)frexp(ctm.yx, &expt); + if ( expt > scale ) scale = expt; + pfc->skewed = 1; + } + if ( !((*(long *)(&(ctm.yy)) << 1) == 0) ) + { (void)frexp(ctm.yy, &expt); + if ( expt > scale ) scale = expt; + } + scale = sizeof(long) * 8 - 1 - max_bits - scale; + shift = scale - 12; + if ( shift > 0 ) + { pfc->shift = shift; + pfc->round = (fixed)1 << (shift - 1); + } + else + { pfc->shift = 0; + pfc->round = 0; + scale -= shift; + } + pfc->xx = (((*(long *)(&(ctm.xx)) << 1) == 0) ? 0 : (long)ldexp(ctm.xx, scale)); + pfc->yy = (((*(long *)(&(ctm.yy)) << 1) == 0) ? 0 : (long)ldexp(ctm.yy, scale)); + if ( pfc->skewed ) + { pfc->xy = (((*(long *)(&(ctm.xy)) << 1) == 0) ? 0 : (long)ldexp(ctm.xy, scale)); + pfc->yx = (((*(long *)(&(ctm.yx)) << 1) == 0) ? 0 : (long)ldexp(ctm.yx, scale)); + } + else + pfc->xy = pfc->yx = 0; + pfc->max_bits = max_bits; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-3.c b/gcc/testsuite/gcc.c-torture/compile/920428-3.c new file mode 100644 index 000000000..13640c98a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-3.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +x(a){static void*j[]={&&l1,&&l2};goto*j[a];l1:return 0;l2:return 1;} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-4.c b/gcc/testsuite/gcc.c-torture/compile/920428-4.c new file mode 100644 index 000000000..cc5e30c2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-4.c @@ -0,0 +1 @@ +x(a){struct{int p[a],i;}l;l.i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-5.c b/gcc/testsuite/gcc.c-torture/compile/920428-5.c new file mode 100644 index 000000000..ff3137992 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-5.c @@ -0,0 +1 @@ +typedef struct{unsigned b0:1;}*t;x(a,b)t a,b;{b->b0=a->b0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-6.c b/gcc/testsuite/gcc.c-torture/compile/920428-6.c new file mode 100644 index 000000000..e43af7ed3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-6.c @@ -0,0 +1,22 @@ +typedef struct x +{ + struct x *type; + struct x *chain; + struct x *value; +} *tree; + +int +func (new, old) + register tree new, old; +{ + if (old->type == 0 || new->type == 0) + { + register tree t = old->type; + if (t == 0) + t = new->type; + for (; t; t = t->chain ) + if (t->value) + return 1; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-7.c b/gcc/testsuite/gcc.c-torture/compile/920428-7.c new file mode 100644 index 000000000..69b1d979a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-7.c @@ -0,0 +1 @@ +x(float*x){int a[4],i=0,j;for(j=0;j<2;j++){f(a[i++]);f(a[i++]);}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-1.c b/gcc/testsuite/gcc.c-torture/compile/920501-1.c new file mode 100644 index 000000000..29e197341 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-1.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +a(){int**b[]={&&c};c:;} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-10.c b/gcc/testsuite/gcc.c-torture/compile/920501-10.c new file mode 100644 index 000000000..ecb5bb415 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-10.c @@ -0,0 +1 @@ +x(y){return 8193*y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-11.c b/gcc/testsuite/gcc.c-torture/compile/920501-11.c new file mode 100644 index 000000000..d636357e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-11.c @@ -0,0 +1 @@ +typedef struct{int s;}S;foo(){int i=(int)&(S){(void*)((int)&(S){1})};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-12.c b/gcc/testsuite/gcc.c-torture/compile/920501-12.c new file mode 100644 index 000000000..7eac97246 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-12.c @@ -0,0 +1,10 @@ +/* This test fails on HC11/HC12 when it is compiled without -mshort because + the stack arrays are too large. Force to use 16-bit ints for it. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "-mshort" } } */ + +x(x){ return 3 + x;} +a(x){int y[994]; return 3 + x;} +b(x){int y[999]; return 2*(x + 3);} +A(x){int y[9999];return 2*(x + 3);} +B(x){int y[9949];return 3 + x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-13.c b/gcc/testsuite/gcc.c-torture/compile/920501-13.c new file mode 100644 index 000000000..b5a6798ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-13.c @@ -0,0 +1 @@ +typedef struct{int i;}t;inline y(t u){}x(){t u;y(u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-15.c b/gcc/testsuite/gcc.c-torture/compile/920501-15.c new file mode 100644 index 000000000..81fd66401 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-15.c @@ -0,0 +1 @@ +x(a)double a;{int i;return i>a?i:i+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-16.c b/gcc/testsuite/gcc.c-torture/compile/920501-16.c new file mode 100644 index 000000000..f82b7524b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-16.c @@ -0,0 +1 @@ +f(n){struct z{int a,b[n],c[n];};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-17.c b/gcc/testsuite/gcc.c-torture/compile/920501-17.c new file mode 100644 index 000000000..05a4d408d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-17.c @@ -0,0 +1 @@ +x(){static const char x[]="x";char y[2];y[0]=x[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-18.c b/gcc/testsuite/gcc.c-torture/compile/920501-18.c new file mode 100644 index 000000000..70f7c0af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-18.c @@ -0,0 +1,2 @@ +union u{int i;float f;}; +x(p)int p;{union u x;for(x.i=0;x.i<p;x.i++)if(x.f>(float)3.0)break;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-19.c b/gcc/testsuite/gcc.c-torture/compile/920501-19.c new file mode 100644 index 000000000..1671cc37e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-19.c @@ -0,0 +1 @@ +long long x=0;y(){x=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-2.c b/gcc/testsuite/gcc.c-torture/compile/920501-2.c new file mode 100644 index 000000000..905f5ddb6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-2.c @@ -0,0 +1,11 @@ +extern short distdata[64][64], taxidata[64][64]; +extern short PieceList[2][64]; + +int +ScoreKBNK (short int winner, short int king1, short int king2) +{ + register short s; + + s = taxidata[king1][king2] + distdata[PieceList[winner][1]][king2]; + return s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-20.c b/gcc/testsuite/gcc.c-torture/compile/920501-20.c new file mode 100644 index 000000000..170d05017 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-20.c @@ -0,0 +1 @@ +int*f(x)int*x;{if(x[4]){int h[1];if(setjmp(h))return x;}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-21.c b/gcc/testsuite/gcc.c-torture/compile/920501-21.c new file mode 100644 index 000000000..4a9f05a1b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-21.c @@ -0,0 +1,3 @@ +typedef unsigned short t; +struct foo{t d;}; +int bar(d)t d;{struct foo u;u.d=d;return(int)(&u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-22.c b/gcc/testsuite/gcc.c-torture/compile/920501-22.c new file mode 100644 index 000000000..b15d7984b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-22.c @@ -0,0 +1 @@ +x(){int y[]={};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-23.c b/gcc/testsuite/gcc.c-torture/compile/920501-23.c new file mode 100644 index 000000000..291d93e6c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-23.c @@ -0,0 +1,16 @@ +typedef unsigned char qi; +typedef unsigned short hi; +typedef unsigned long si; +typedef unsigned long long di; +subi(a){return 100-a;} +add(a,b){return a+b;} +mul(a){return 85*a;} +memshift(p)unsigned*p;{unsigned x;for(;;){x=*p++>>16;if(x)return x;}} +ldw(xp)si*xp;{return xp[4];} +ldws_m(xp)si*xp;{si x;do{x=xp[3];xp+=3;}while(x);} +postinc_si(p)si*p;{si x;for(;;){x=*p++;if(x)return x;}} +preinc_si(p)si*p;{si x;for(;;){x=*++p;if(x)return x;}} +postinc_di(p)di*p;{di x;for(;;){x=*p++;if(x)return x;}} +preinc_di(p)di*p;{di x;for(;;){x=*++p;if(x)return x;}} +inc_overlap(p,a)di*p;{do{p=*(di**)p;p=(di*)((int)p+4);}while(*p);} +di move_di(p,p2)di*p,*p2;{di x=p;p2=((di*)x)[1];return p2[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-3.c b/gcc/testsuite/gcc.c-torture/compile/920501-3.c new file mode 100644 index 000000000..41ef87fbf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-3.c @@ -0,0 +1,2 @@ +struct{long long x:24,y:40;}v; +x(){v.y=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-4.c b/gcc/testsuite/gcc.c-torture/compile/920501-4.c new file mode 100644 index 000000000..3481deefe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-4.c @@ -0,0 +1,54 @@ +/* This test fails on HC11/HC12 when it is compiled without -mshort because + the 'r0' array is too large. Force to use 16-bit ints for it. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "-mshort" } } */ + +foo () +{ + int r0[8186 ]; + int r1[2 ]; + int r2[2 ]; + int bitm0[2 ]; + int bitm1[2 ]; + int bitm2[2 ]; + + int i,j,k,m,n,m_max; + int f; + double fm,ft; + + while (1) { + + if (m%4 == 2) + ++m; + + if (m_max != 0 && m > m_max) + break; + + fm=m; + + r0[k=1]=0; + bitm0[0] = 0; + + while ( n%f == 0 ) { + while ( (ft != 0) && (ft < fm )) { + bitm1[i] = 0; + r1[i]=0; + } + + while ( r0[i] != 0 && r1[i] != 0 ) { + if ( r0[i] < r1[i] ) { + bitm2[k] = bitm0[i]; + r2[k++]=0; + } + else if ( r0[i] > r1[j] ) { + bitm2[k] = bitm1[j]; + r2[k++]=r1[j++]; + } + else { + bitm1[k] = bitm0[i]; + r2[k++]=r0[i++]; + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-6.c b/gcc/testsuite/gcc.c-torture/compile/920501-6.c new file mode 100644 index 000000000..d0a406381 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-6.c @@ -0,0 +1 @@ +x(y,z)float*y;{*y=z;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-7.c b/gcc/testsuite/gcc.c-torture/compile/920501-7.c new file mode 100644 index 000000000..aed88045e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-7.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +x(){if(&&e-&&b<0)x();b:goto*&&b;e:;} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-8.c b/gcc/testsuite/gcc.c-torture/compile/920501-8.c new file mode 100644 index 000000000..68e33934d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-8.c @@ -0,0 +1 @@ +x(int*p){int x=p;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-9.c b/gcc/testsuite/gcc.c-torture/compile/920501-9.c new file mode 100644 index 000000000..98a06000b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-9.c @@ -0,0 +1 @@ +short x(a)unsigned a;{a=32987799;return a;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-1.c b/gcc/testsuite/gcc.c-torture/compile/920502-1.c new file mode 100644 index 000000000..b576c6c99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920502-1.c @@ -0,0 +1 @@ +extern void*t[];x(i){goto*t[i];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-2.c b/gcc/testsuite/gcc.c-torture/compile/920502-2.c new file mode 100644 index 000000000..d3aa1e26d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920502-2.c @@ -0,0 +1 @@ +x(c){1LL<<c;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920520-1.c b/gcc/testsuite/gcc.c-torture/compile/920520-1.c new file mode 100644 index 000000000..e090b32d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920520-1.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "" } } */ +/* { dg-skip-if "" { pdp11-*-* } { "*" } { "" } } */ + +f(){asm("%0"::"r"(1.5F));}g(){asm("%0"::"r"(1.5));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920521-1.c b/gcc/testsuite/gcc.c-torture/compile/920521-1.c new file mode 100644 index 000000000..6c4c99d70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920521-1.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ + +f(){asm("f":::"cc");}g(x,y){asm("g"::"%r"(x), "r"(y));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920529-1.c b/gcc/testsuite/gcc.c-torture/compile/920529-1.c new file mode 100644 index 000000000..0f50309a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920529-1.c @@ -0,0 +1,21 @@ +void +f (a, b, m, n) + unsigned short *a, *b; + int m, n; +{ + unsigned long acc; + int qn; + int j; + + abort (); + + acc = a[m - 1]; + a += 0; + for (j = qn - 1; j >= 0; j = j - 1) + { + acc = (acc << 16) | a[j]; + acc = acc % *b; + } + + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920608-1.c b/gcc/testsuite/gcc.c-torture/compile/920608-1.c new file mode 100644 index 000000000..cae1978e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920608-1.c @@ -0,0 +1,25 @@ +foo (p) + int *p; +{ + int x; + int a; + + a = p[0]; + x = a + 5; + a = -1; + p[0] = x - 5; + return a; +} + +bar (p) +{ + short x; + int a; + + x = ((short *) p)[1]; +#if INHIBIT_COMBINE + ((short *) p)[0] = x; +#endif + + return (x < 45); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920611-2.c b/gcc/testsuite/gcc.c-torture/compile/920611-2.c new file mode 100644 index 000000000..e54b1cda5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920611-2.c @@ -0,0 +1,53 @@ +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +static unsigned long S[1][1]={0x00820200}; + +static int body(out0,out1,ks,Eswap0,Eswap1) +ulong *out0,*out1; +int *ks; +ulong Eswap0,Eswap1; +{ + register unsigned long l,r,t,u,v; + register unsigned long *s; + register int i,j; + register unsigned long E0,E1; + + l=0; + r=0; + + s=(ulong *)ks; + E0=Eswap0; + E1=Eswap1; + + for (i=0; i<(16 *2); i+=4) + { + v=(r^(r>>16)); + u=(v&E0); + v=(v&E1); + u=(u^(u<<16))^r^s[ i ]; + t=(v^(v<<16))^r^s[ i+1]; + t=(t>>4)|(t<<28); + l^=S[1][(t)&0x3f]| S[3][(t>> 8)&0x3f]| S[5][(t>>16)&0x3f]| S[7][(t>>24)&0x3f]| S[0][(u)&0x3f]| S[2][(u>> 8)&0x3f]| S[4][(u>>16)&0x3f]| S[6][(u>>24)&0x3f]; + v=(l^(l>>16)); + u=(v&E0); + v=(v&E1); + u=(u^(u<<16))^l^s[ i+2 ]; + t=(v^(v<<16))^l^s[ i+2+1]; + t=(t>>4)|(t<<28); + r^= S[1][(t )&0x3f]; + } + t=l; + l=r; + r=t; + + t=r; + r=(l>>1)|(l<<31); + l=(t>>1)|(t<<31); + + *out0=l; + *out1=r; + return(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920615-1.c b/gcc/testsuite/gcc.c-torture/compile/920615-1.c new file mode 100644 index 000000000..9b1c6acee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920615-1.c @@ -0,0 +1,4 @@ +f() +{ + int x[20] = {[0] = 5, [10] = 12}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-1.c b/gcc/testsuite/gcc.c-torture/compile/920617-1.c new file mode 100644 index 000000000..2d84e8d84 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920617-1.c @@ -0,0 +1 @@ +f(){double*xp,y;*xp++=sqrt(y);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-2.c b/gcc/testsuite/gcc.c-torture/compile/920617-2.c new file mode 100644 index 000000000..3a5450982 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920617-2.c @@ -0,0 +1 @@ +f(a,b,c,d)float a[],d;int b[],c;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920623-1.c b/gcc/testsuite/gcc.c-torture/compile/920623-1.c new file mode 100644 index 000000000..9b6ad51e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920623-1.c @@ -0,0 +1,2 @@ +int f(int c){return f(c--);} +g(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920624-1.c b/gcc/testsuite/gcc.c-torture/compile/920624-1.c new file mode 100644 index 000000000..8b4d2979d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920624-1.c @@ -0,0 +1,2 @@ +int B[],Q[]; +f(){int s;for(s=0;s<=1;s++)switch(s){case 2:case 3:++B[s];case 4:case 5:++Q[s];}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.c b/gcc/testsuite/gcc.c-torture/compile/920625-1.c new file mode 100644 index 000000000..720d43fd4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-1.c @@ -0,0 +1,279 @@ +typedef unsigned long int unsigned_word; +typedef signed long int signed_word; +typedef unsigned_word word; + +typedef enum { ADD, ADD_CI, ADD_CO, ADD_CIO, SUB, SUB_CI, SUB_CO, +SUB_CIO, ADC_CI, ADC_CO, ADC_CIO, AND, IOR, XOR, ANDC, IORC, EQV, +NAND, NOR, AND_RC, IOR_RC, XOR_RC, ANDC_RC, IORC_RC, EQV_RC, NAND_RC, +NOR_RC, AND_CC, IOR_CC, XOR_CC, ANDC_CC, IORC_CC, EQV_CC, NAND_CC, +NOR_CC, LSHIFTR, ASHIFTR, SHIFTL, LSHIFTR_CO, ASHIFTR_CO, SHIFTL_CO, +ROTATEL, ROTATEL_CO, ROTATEXL_CIO, ASHIFTR_CON, EXTS1, EXTS2, EXTU1, +EXTU2, CLZ, CTZ, FF1, FF0, ABSVAL, NABSVAL, CMP, CPEQ, CPGE, CPGEU, +CPGT, CPGTU, CPLE, CPLEU, CPLT, CPLTU, CPNEQ, CMPPAR, DOZ, COPY, +EXCHANGE, COMCY, } opcode_t; + +typedef struct +{ + opcode_t opcode:8; + unsigned int s1:8; + unsigned int s2:8; + unsigned int d:8; +} insn_t; + +enum prune_flags +{ + NO_PRUNE = 0, + CY_0 = 1, + CY_1 = 2, + CY_JUST_SET = 4, +}; + +int flag_use_carry = 1; + +inline +recurse(opcode_t opcode, + int d, + int s1, + int s2, + word v, + int cost, + insn_t *sequence, + int n_insns, + word *values, + int n_values, + const word goal_value, + int allowed_cost, + int cy, + int prune_flags) +{ + insn_t insn; + + allowed_cost -= cost; + + if (allowed_cost > 0) + { + word old_d; + + old_d = values[d]; + values[d] = v; + + insn.opcode = opcode; + insn.s1 = s1; + insn.s2 = s2; + insn.d = d; + sequence[n_insns] = insn; + + synth(sequence, n_insns + 1, values, n_values, + goal_value, allowed_cost, cy, prune_flags); + + values[d] = old_d; + } + else if (goal_value == v) + { + insn.opcode = opcode; + insn.s1 = s1; + insn.s2 = s2; + insn.d = d; + sequence[n_insns] = insn; + test_sequence(sequence, n_insns + 1); + } +} + +synth(insn_t *sequence, + int n_insns, + word *values, + int n_values, + word goal_value, + int allowed_cost, + int ci, + int prune_hint) +{ + int s1, s2; + word v, r1, r2; + int co; + int last_dest; + + if (n_insns > 0) + last_dest = sequence[n_insns - 1].d; + else + last_dest = -1; + if (ci >= 0 && flag_use_carry) + { + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + for (s2 = s1 - 1; s2 >= 0; s2--) + { + r2 = values[s2]; + + if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) + { + if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) + continue; + } + do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(ADD_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci) ? __d >= ( r1) : __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( r2) : __d > ( r2); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(SUB_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(SUB_CI, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + } + } + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + for (s2 = s1 - 1; s2 >= 0; s2--) + { + r2 = values[s2]; + + if (allowed_cost <= 1) + { + if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) + continue; + } + + do { word __d = ( r1) + ( r2); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + ((v) = ( r1) + ( r2), ( co) = ( ci)); + recurse(ADD, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) - ( r2); ( co) = __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r2) - ( r1); ( co) = __d > ( r2); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( r1) - ( r2), ( co) = ( ci)); + recurse(SUB, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) & ( r2), ( co) = ( ci)); + recurse(AND, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) | ( r2), ( co) = ( ci)); + recurse(IOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) ^ ( r2), ( co) = ( ci)); + recurse(XOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) & ~( r2), ( co) = ( ci)); + recurse(ANDC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) & ~( r1), ( co) = ( ci)); + recurse(ANDC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r1) | ~( r2), ( co) = ( ci)); + recurse(IORC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) | ~( r1), ( co) = ( ci)); + recurse(IORC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r1) ^ ~( r2), ( co) = ( ci)); + recurse(EQV, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + } + if (ci >= 0 && flag_use_carry) + { + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + + if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) + { + + if (last_dest >= 0 && s1 != last_dest) + continue; + } + + do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(ADD_CI, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( 0 ) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + } + } + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + + if (allowed_cost <= 1) + { + if (last_dest >= 0 && s1 != last_dest) + continue; + } + do { word __d = ( r1) + ( r1); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + ((v) = ( r1) & ( 1 ), ( co) = ( ci)); + recurse(AND, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) ^ ( 1 ), ( co) = ( ci)); + recurse(XOR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( -1 ) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, (0x20 + -1) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r1) + ( 1 ); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( r1) + ( 1 ), ( co) = ( ci)); + recurse(ADD, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r1) + ( -1 ); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r1) - ( 1 ); ( co) = __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( 0 ) - ( r1); ( co) = __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( 0 ) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((unsigned_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(LSHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(ASHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) << (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(SHIFTL, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((unsigned_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(LSHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(ASHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + } + if (ci >= 0 && flag_use_carry + && (allowed_cost <= 1 ? ((prune_hint & CY_JUST_SET) != 0) : 1)) + { + do { word __d = ( 0 ) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_0); + do { word __d = ( 0 ) - ( 0 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( 0 ) - ( -1 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_1); + do { word __d = ( 0 ) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + + if (allowed_cost > 1) + { + ((v) = ( 0x80000000 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 - 2) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( -1 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 + -1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( 1 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 + 1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-2.c b/gcc/testsuite/gcc.c-torture/compile/920625-2.c new file mode 100644 index 000000000..291e80d02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-2.c @@ -0,0 +1,103 @@ +typedef char * caddr_t; +typedef unsigned Cursor; +typedef char *String; +typedef struct _WidgetRec *Widget; +typedef char Boolean; +typedef unsigned int Cardinal; +typedef struct _XedwListReturnStruct { + String string; + int xedwList_index; + struct _XedwListReturnStruct *next; +} XedwListReturnStruct; +static XedwListReturnStruct *return_list; +static String srcdir, dstdir; +char *strcpy(); + extern void setCursor(Cursor); + extern void query_dialog(String, Boolean); + extern Boolean directoryManagerNewDirectory(String); +trashQueryResult(Widget w, Boolean delete, caddr_t call_data) +{ + int execute(String, String, String, Boolean); + extern void destroy_button_dialog(void); + extern void changestate(Boolean); + + extern Cursor busy, left_ptr; + extern String cwd; + extern void freeReturnStruct(void); + String rmstring; + int status; + XedwListReturnStruct *tmp; + setCursor(busy); + destroy_button_dialog(); + if (delete == 1) { + rmstring = (("rm -fr") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("rm -fr") + 1), "rm -fr")) : ((void *)0)); + tmp = return_list; + while (tmp != ((void *)0)) { + rmstring = (String) XtRealloc (rmstring, sizeof(char) * + (strlen(rmstring) + + strlen(tmp->string) + 5)); + sprintf(rmstring, "%s '%s'", rmstring, tmp->string); + tmp = tmp->next; + } + if ((status = execute(((void *)0), "rm", rmstring, 1)) != 0) { + XBell(XtDisplay(w), 100); + query_dialog("Can't remove file", 0); + } + XtFree(rmstring); + + directoryManagerNewDirectory(cwd); + } else { + changestate(1); + } + setCursor(left_ptr); + freeReturnStruct(); +} + +copyQueryResult(Widget w, Boolean copy, caddr_t call_data) +{ + extern void destroy_button_dialog(); + extern void changestate(Boolean); + extern Cursor busy, left_ptr; + extern void freeReturnStruct(void); + int execute(String, String, String, Boolean); + extern String cwd; + String copystring; + int status; + Cardinal srclen, dstlen; + XedwListReturnStruct *tmp; + destroy_button_dialog(); + setCursor(busy); + if (copy == 1) { + srclen = strlen(srcdir); + dstlen = strlen(dstdir); + copystring = (("cp -r") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("cp -r") + 1), "cp -r")) : ((void *)0)); + tmp = return_list; + while (tmp != ((void *)0)) { + copystring = (String) XtRealloc (copystring, sizeof(char) * + (strlen(copystring) + + strlen(tmp->string) + + srclen + 6)); + sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string); + tmp = tmp->next; + } + copystring = (String) XtRealloc (copystring, sizeof(char) * + (strlen(copystring) + + dstlen + 5)); + sprintf(copystring, "%s '%s'", copystring, dstdir); + if ((status = execute(((void *)0), "cp", copystring, 1)) != 0) { + XBell(XtDisplay(w), 100); + query_dialog("Can't copy file!", 0); + } + XtFree(copystring); + + directoryManagerNewDirectory(cwd); + } else { + changestate(1); + } + XtFree(srcdir); + XtFree(dstdir); + setCursor(left_ptr); + freeReturnStruct(); +} + +freeReturnStruct(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920626-1.c b/gcc/testsuite/gcc.c-torture/compile/920626-1.c new file mode 100644 index 000000000..54419866a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920626-1.c @@ -0,0 +1 @@ +f(x)unsigned x;{return x>>-5;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920701-1.c b/gcc/testsuite/gcc.c-torture/compile/920701-1.c new file mode 100644 index 000000000..4302f9ea3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920701-1.c @@ -0,0 +1 @@ +f(char*c){extern char a[],b[];return a+(b-c);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920702-1.c b/gcc/testsuite/gcc.c-torture/compile/920702-1.c new file mode 100644 index 000000000..23a5395b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920702-1.c @@ -0,0 +1,10 @@ +int somevar; +void +yylex () +{ + register int result = 0; + int num_bits = -1; + + if (((result >> -1) & 1)) + somevar = 99; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920706-1.c b/gcc/testsuite/gcc.c-torture/compile/920706-1.c new file mode 100644 index 000000000..13b0ff1e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920706-1.c @@ -0,0 +1 @@ +f(){float i[2],o[1];g(o);return*o;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920710-2.c b/gcc/testsuite/gcc.c-torture/compile/920710-2.c new file mode 100644 index 000000000..dcaf1bea3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920710-2.c @@ -0,0 +1,36 @@ +union u +{ + struct {unsigned h, l;} i; + double d; +}; + +foo (union u x) +{ + while (x.i.h++) + { + while (x.i.l-- > 0) + ; + while (x.d++ > 0) + ; + } +} + +union n +{ + long long unsigned i; + double d; +}; + +bar (union n x) +{ + int i; + for (i = 0; i < 100; i++) + { + while (--x.i > 0) + ; + while (++x.d > 0) + ; + } + return x.i; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920711-1.c b/gcc/testsuite/gcc.c-torture/compile/920711-1.c new file mode 100644 index 000000000..a5aa7df11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920711-1.c @@ -0,0 +1 @@ +f(a){a=(1,1)/2;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920721-1.c b/gcc/testsuite/gcc.c-torture/compile/920721-1.c new file mode 100644 index 000000000..7ced611eb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920721-1.c @@ -0,0 +1,11 @@ +typedef struct{short ttype;float s;}T; +short t[8][8]; + +T f(T t2,T t1) +{ + T x; + if (t1.ttype == 1) + x.ttype = t[t2.ttype][t1.ttype], + x.s = 1; + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920723-1.c b/gcc/testsuite/gcc.c-torture/compile/920723-1.c new file mode 100644 index 000000000..d8734a679 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920723-1.c @@ -0,0 +1,31 @@ +#if defined(STACK_SIZE) && STACK_SIZE < 65536 +# define GITT_SIZE 75 +#endif + +#ifndef GITT_SIZE +# define GITT_SIZE 150 +#endif + +typedef struct { + double x, y; +} vector_t; +double sqrt(); +f(int count,vector_t*pos,double r,double *rho) +{ + int i, j, miny, maxy, hy; + float help, d; + int gitt[GITT_SIZE][GITT_SIZE]; + int *data = (int *)malloc(count*sizeof(int)); + for (i = 0; i < count; i++) + rho[i] = 0; + for (i = 1; i < count; i++) + for (hy = miny; hy<= maxy; hy++) + while(j >=0) { + d = pos[i].y - pos[j].y; + if ( d <= r) { + d = sqrt(d); + rho[i] += help; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920729-1.c b/gcc/testsuite/gcc.c-torture/compile/920729-1.c new file mode 100644 index 000000000..de00be5af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920729-1.c @@ -0,0 +1,2 @@ +extern volatile int i; +f(){int j;for(;;)j = i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920806-1.c b/gcc/testsuite/gcc.c-torture/compile/920806-1.c new file mode 100644 index 000000000..0928fe8a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920806-1.c @@ -0,0 +1 @@ +f(){short x=32000;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920808-1.c b/gcc/testsuite/gcc.c-torture/compile/920808-1.c new file mode 100644 index 000000000..17510a968 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920808-1.c @@ -0,0 +1 @@ +f(i){for(i=1;i<=2;({;}),i++){({;}),g();}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920809-1.c b/gcc/testsuite/gcc.c-torture/compile/920809-1.c new file mode 100644 index 000000000..ad35e1210 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920809-1.c @@ -0,0 +1 @@ +f(x,y){memcpy (&x,&y,8192);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920817-1.c b/gcc/testsuite/gcc.c-torture/compile/920817-1.c new file mode 100644 index 000000000..31a57339e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920817-1.c @@ -0,0 +1 @@ +int v;static inline f(){return 0;}g(){return f();}void h(){return v++;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920820-1.c b/gcc/testsuite/gcc.c-torture/compile/920820-1.c new file mode 100644 index 000000000..2bc0dbea0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920820-1.c @@ -0,0 +1 @@ +long long f(double y){return y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-1.c b/gcc/testsuite/gcc.c-torture/compile/920821-1.c new file mode 100644 index 000000000..40a8c178f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920821-1.c @@ -0,0 +1 @@ +/* empty */ diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-2.c b/gcc/testsuite/gcc.c-torture/compile/920821-2.c new file mode 100644 index 000000000..a69c0a901 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920821-2.c @@ -0,0 +1,4 @@ +typedef struct{int p[25];}t1; +struct{t1 x,y;}y; +t1 x[1]; +f(){y.x=*x;y.y=*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-1.c b/gcc/testsuite/gcc.c-torture/compile/920825-1.c new file mode 100644 index 000000000..514d63f97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920825-1.c @@ -0,0 +1,3 @@ +#pragma pack(1) +struct{unsigned short f1:5;unsigned short f2:6;}x; +f(){x.f2=1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-2.c b/gcc/testsuite/gcc.c-torture/compile/920825-2.c new file mode 100644 index 000000000..9834aac17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920825-2.c @@ -0,0 +1,3 @@ +f(double*a,int m){int j;for(j=0;j<m;j++)a[j]=1;} +g(double*a){int j;for(j=0;j<4;j++)a[j]=1;} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920826-1.c b/gcc/testsuite/gcc.c-torture/compile/920826-1.c new file mode 100644 index 000000000..d19eff2ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920826-1.c @@ -0,0 +1 @@ +f(int*x){goto*(char)*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920828-1.c b/gcc/testsuite/gcc.c-torture/compile/920828-1.c new file mode 100644 index 000000000..489317342 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920828-1.c @@ -0,0 +1 @@ +char a[]={4,5};f(n){return a[n<2?n:0];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920829-1.c b/gcc/testsuite/gcc.c-torture/compile/920829-1.c new file mode 100644 index 000000000..593400bac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920829-1.c @@ -0,0 +1 @@ +f(double x){double y;y=x/0.5;if(y<0.1)y=1.0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920831-1.c b/gcc/testsuite/gcc.c-torture/compile/920831-1.c new file mode 100644 index 000000000..ff2fd6360 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920831-1.c @@ -0,0 +1 @@ +f(x){goto*(char)x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920902-1.c b/gcc/testsuite/gcc.c-torture/compile/920902-1.c new file mode 100644 index 000000000..6f6dcd5bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920902-1.c @@ -0,0 +1,2 @@ +void f(int); +void f(x)unsigned char x;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920909-1.c b/gcc/testsuite/gcc.c-torture/compile/920909-1.c new file mode 100644 index 000000000..939aaf789 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920909-1.c @@ -0,0 +1 @@ +long long f(long long a,long long b){return a<<b;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920917-1.c b/gcc/testsuite/gcc.c-torture/compile/920917-1.c new file mode 100644 index 000000000..ebe8200d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920917-1.c @@ -0,0 +1,2 @@ +inline f(x){switch(x){case 6:case 4:case 3:case 1:;}return x;} +g(){f(sizeof("xxxxxx"));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-1.c b/gcc/testsuite/gcc.c-torture/compile/920928-1.c new file mode 100644 index 000000000..137363dc1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-1.c @@ -0,0 +1,2 @@ +struct{int c;}v; +static long i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-2.c b/gcc/testsuite/gcc.c-torture/compile/920928-2.c new file mode 100644 index 000000000..a0964f90f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-2.c @@ -0,0 +1,19 @@ +typedef struct{struct{char*d;int b;}*i;}*t; +double f(); +g(p)t p; +{ + short x,y,delta,s,w,h,fx,fy,tx,ty; + int q1,q2,q3,q4; + h=f((ty-fy)/2.0+0.5); + s=(((int)((short)(tx-fx))<(int)((short)(ty-fy)))?((short)(tx-fx)):((short)(ty-fy)))%2; + delta=(((int)(w)<(int)(h))?(w):(h))-s; + for(x=0;x<=delta;x++) + for(y=1-s;y<=delta;y++){ + q1=((int)((*(p->i->d+(fx+w+x)/8+(fy+h+y)*p->i->b)&(1<<((fx+w+x)%8)))?1:0)); + q2=((int)((*(p->i->d+(fx+w+y)/8+(fy+h-s-x)*p->i->b)&(1<<((fx+w+y)%8)))?1:0)); + q3=((int)((*(p->i->d+(fx+w-s-x)/8+(fy+h-s-y)*p->i->b)&(1<<((fx+w-s-x)%8)))?1:0)); + q4=((int)((*(p->i->d+(fx+w-s-y)/8+(fy+h+x)*p->i->b)&(1<<((fx+w-s-y)%8)))?1:0)); + if(q4!=q1) + ff(p,fx+w-s-y,fy+h+x); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-3.c b/gcc/testsuite/gcc.c-torture/compile/920928-3.c new file mode 100644 index 000000000..583dc69b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-3.c @@ -0,0 +1,19 @@ +f (int phaseone) +{ + typedef struct + { + unsigned char *p; + } + FILE; + FILE b[2]; + static unsigned char xchr[2]; + int j; + int for_end; + if (phaseone) + { + if (j <= for_end) + do + *(b[1].p) = xchr[j]; + while (j++ < 10); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-4.c b/gcc/testsuite/gcc.c-torture/compile/920928-4.c new file mode 100644 index 000000000..348de654f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-4.c @@ -0,0 +1,113 @@ +typedef unsigned char unsigned8; +typedef unsigned short int unsigned16; +typedef unsigned long int unsigned32; +typedef char signed8; +typedef short int signed16; +typedef long int signed32; +typedef unsigned32 boolean32; +typedef unsigned long int error_status_t; +typedef struct { + unsigned32 time_low; + unsigned16 time_mid; + unsigned16 time_hi_and_version; + unsigned8 clock_seq_hi_and_reserved; + unsigned8 clock_seq_low; + unsigned char node[6]; +} uuid_t; + +typedef unsigned32 bitset; +typedef signed32 sec_timeval_sec_t; +typedef struct { + signed32 sec; + signed32 usec; +} sec_timeval_t; +typedef signed32 sec_timeval_period_t; +typedef signed32 sec_rgy_acct_key_t; + +typedef struct { + uuid_t source; + signed32 handle; + boolean32 valid; +} sec_rgy_cursor_t; +typedef unsigned char sec_rgy_pname_t[257]; +typedef unsigned char sec_rgy_name_t[1025]; + +typedef signed32 sec_rgy_override_t; +typedef signed32 sec_rgy_mode_resolve_t; +typedef unsigned char sec_rgy_unix_gecos_t[292]; +typedef unsigned char sec_rgy_unix_login_name_t[1025]; +typedef unsigned char sec_rgy_member_t[1025]; +typedef unsigned char sec_rgy_unix_passwd_buf_t[16]; +typedef struct sec_rgy_sid_t { + uuid_t person; + uuid_t group; + uuid_t org; +} sec_rgy_sid_t; +typedef struct { + signed32 person; + signed32 group; + signed32 org; +} sec_rgy_unix_sid_t; +typedef struct { + sec_rgy_unix_login_name_t name; + sec_rgy_unix_passwd_buf_t passwd; + signed32 uid; + signed32 gid; + signed32 oid; + sec_rgy_unix_gecos_t gecos; + sec_rgy_pname_t homedir; + sec_rgy_pname_t shell; +} sec_rgy_unix_passwd_t; +typedef unsigned char sec_rgy_member_buf_t[10250]; +typedef struct { + sec_rgy_name_t name; + signed32 gid; + sec_rgy_member_buf_t members; +} sec_rgy_unix_group_t; + +typedef struct { + uuid_t site_id; + sec_timeval_sec_t person_dtm; + sec_timeval_sec_t group_dtm; + sec_timeval_sec_t org_dtm; +} rs_cache_data_t; + +typedef enum { + rs_unix_query_name, + rs_unix_query_unix_num, + rs_unix_query_none +} rs_unix_query_t; + +typedef struct { + rs_unix_query_t query; + union { + struct { + long int name_len; + sec_rgy_name_t name; + } name; + long int unix_num; + } tagged_union; +} rs_unix_query_key_t; + +static unsigned long int IDL_offset_vec[] = +{ + 0, + sizeof(sec_rgy_unix_group_t), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->name - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->gid - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->members - (unsigned char *) 0), + sizeof(rs_cache_data_t), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_low - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_mid - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_hi_and_version - (unsigned char *) 0), + sizeof(sec_rgy_unix_passwd_t), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_hi_and_reserved - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_low - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.node - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->handle - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->valid - (unsigned char *) 0), + sizeof(struct {long int name_len; sec_rgy_name_t name;}), + (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name_len + - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name - (unsigned char *) 0), +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-5.c b/gcc/testsuite/gcc.c-torture/compile/920928-5.c new file mode 100644 index 000000000..8c975f0c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-5.c @@ -0,0 +1,7 @@ +/* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */ +struct b{}; +f(struct b(*f)()) +{ +struct b d=f(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-6.c b/gcc/testsuite/gcc.c-torture/compile/920928-6.c new file mode 100644 index 000000000..692191b12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-6.c @@ -0,0 +1,2 @@ +struct{int c;}v; +static short i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/921004-1.c b/gcc/testsuite/gcc.c-torture/compile/921004-1.c new file mode 100644 index 000000000..a94722908 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921004-1.c @@ -0,0 +1,6 @@ +/* REPRODUCED:CC1:SIGNAL MACHINE:i386 OPTIONS: */ +long long f() +{ +long long*g,*s; +return*g+*s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-1.c b/gcc/testsuite/gcc.c-torture/compile/921011-1.c new file mode 100644 index 000000000..6cc707dc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921011-1.c @@ -0,0 +1,27 @@ +void +fun (nb) + int nb; +{ + int th, h, em, nlwm, nlwS, nlw, sy; + + while (nb--) + while (h--) + { + nlw = nlwm; + while (nlw) + { + if (nlwS == 1) + { + } + else + if (nlwS == 1) + { + } + nlwS--; nlw--; + } + if (em) + nlwS--; + if (++sy == th) + sy = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-2.c b/gcc/testsuite/gcc.c-torture/compile/921011-2.c new file mode 100644 index 000000000..bf11dad97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921011-2.c @@ -0,0 +1,65 @@ +extern int foobar1 (); + +typedef struct + { + unsigned long colormap; + unsigned long red_max; + unsigned long red_mult; + unsigned long green_max; + unsigned long green_mult; + unsigned long blue_max; + unsigned long blue_mult; + unsigned long base_pixel; + unsigned long visualid; + unsigned long killid; + } +frotz; + +int +foobar (stdcmap, count) + frotz **stdcmap; + int *count; +{ + register int i; + frotz *data = ((void *) 0); + + unsigned long nitems; + int ncmaps; + int old_style = 0; + unsigned long def_visual = 0L; + frotz *cmaps; + + + if ( foobar1 (&data) != 0) + return 0; + if (nitems < 10) + { + ncmaps = 1; + if (nitems < 9) + { + } + } + else + ncmaps = (nitems / 10); + + { + register frotz *map; + register frotz *prop; + + for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) + { + map->colormap = prop->colormap; + map->red_max = prop->red_max; + map->red_mult = prop->red_mult; + map->green_max = prop->green_max; + map->green_mult = prop->green_mult; + map->blue_max = prop->blue_max; + map->blue_mult = prop->blue_mult; + map->base_pixel = prop->base_pixel; + map->visualid = (def_visual ? def_visual : prop->visualid); + map->killid = (old_style ? 0L : prop->killid); + } + } + *stdcmap = cmaps; + *count = ncmaps; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-1.c b/gcc/testsuite/gcc.c-torture/compile/921012-1.c new file mode 100644 index 000000000..7b5cb6b9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921012-1.c @@ -0,0 +1,4 @@ +f() +{ +g(({int x;0;})); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-2.c b/gcc/testsuite/gcc.c-torture/compile/921012-2.c new file mode 100644 index 000000000..6f4de7795 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921012-2.c @@ -0,0 +1,7 @@ +struct foo { +int a,b,c; +}; +f(struct foo*a,struct foo*b) +{ +*a=*b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921013-1.c b/gcc/testsuite/gcc.c-torture/compile/921013-1.c new file mode 100644 index 000000000..0d14cbc6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921013-1.c @@ -0,0 +1,4 @@ +f(int x,short y) +{ +long z=y<0?x>0?x:0:y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921019-1.c b/gcc/testsuite/gcc.c-torture/compile/921019-1.c new file mode 100644 index 000000000..227bdc276 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921019-1.c @@ -0,0 +1,9 @@ +struct +{ +int n:1,c:1; +}p; + +f() +{ +p.c=p.n=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921021-1.c b/gcc/testsuite/gcc.c-torture/compile/921021-1.c new file mode 100644 index 000000000..18dffeb9d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921021-1.c @@ -0,0 +1,12 @@ +void g(); + +f() +{ +int x=1; +while(x) +{ +x=h(); +if(x) +g(); +} +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921024-1.c b/gcc/testsuite/gcc.c-torture/compile/921024-1.c new file mode 100644 index 000000000..e723246d6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921024-1.c @@ -0,0 +1,9 @@ +long long f(s,r) +{ + return *(long long*)(s+r); +} + +g(s,r) +{ + *(long long*)(s+r)=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921026-1.c b/gcc/testsuite/gcc.c-torture/compile/921026-1.c new file mode 100644 index 000000000..18238de83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921026-1.c @@ -0,0 +1,4 @@ +f(unsigned short*a) +{ +a[0]=65535; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921103-1.c b/gcc/testsuite/gcc.c-torture/compile/921103-1.c new file mode 100644 index 000000000..578e91aaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921103-1.c @@ -0,0 +1,12 @@ +struct { + unsigned int f1, f2; +} s; + +f() +{ + unsigned x, y; + x = y = 0; + while (y % 4) + y++; + g(&s.f2, s.f1 + x, 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921109-1.c b/gcc/testsuite/gcc.c-torture/compile/921109-1.c new file mode 100644 index 000000000..eda43451f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921109-1.c @@ -0,0 +1,28 @@ +typedef struct { double x, y; } p; +typedef struct { int s; float r; } t; +t *e, i; +int i1; + +f(t *op) +{ +int i2 = e->r; +p pt; +int c = g(); +t p; + +if (c) +{ +i = *e; +e -= 3; +return 8; +} +if (op > e) +return 1; +op->r = pt.x; +op->r = pt.y; +p = *e; +++e; +e->r = i1, e->s = i1; +*++e = p; +return 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921111-1.c b/gcc/testsuite/gcc.c-torture/compile/921111-1.c new file mode 100644 index 000000000..11b467460 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921111-1.c @@ -0,0 +1,40 @@ +int ps; +struct vp { + int wa; +}; +typedef struct vp *vpt; +typedef struct vc { + int o; + vpt py[8]; +} *vct; +struct n { + int a; +}; +struct nh { + int x; +}; +typedef struct np *npt; +struct np { + vct d; + int di; +}; +struct nh xhp; +struct n np[3]; + +f(dp) + npt dp; +{ + vpt *py; + int a, l, o = 0; + a = dp->d->o; + if (dp->di < 0) + l = ps; + + if ((int)o & 3) + g(); + + xhp.x = a; + py = &dp->d->py[dp->di]; + if (o + l > ps) + np[2].a = (int)(py[1])->wa; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921116-2.c b/gcc/testsuite/gcc.c-torture/compile/921116-2.c new file mode 100644 index 000000000..9eac91cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921116-2.c @@ -0,0 +1,9 @@ +typedef struct { + long l[5]; +} t; + +f(size) +{ + t event; + g(&(event.l[2 + size]), (3 - size) * 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921118-1.c b/gcc/testsuite/gcc.c-torture/compile/921118-1.c new file mode 100644 index 000000000..857c74e74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921118-1.c @@ -0,0 +1,8 @@ +inline f(i) +{ + h((long long) i * 2); +} +g() +{ + f(9); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921126-1.c b/gcc/testsuite/gcc.c-torture/compile/921126-1.c new file mode 100644 index 000000000..a7b908b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921126-1.c @@ -0,0 +1,11 @@ +f() +{ + long long a0, a1, a0s, val; + int width; + float d; + if (d) + ; + if (a0s & (1LL << width)) + ; + return a0 / a1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-1.c b/gcc/testsuite/gcc.c-torture/compile/921202-1.c new file mode 100644 index 000000000..1287edc57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921202-1.c @@ -0,0 +1,22 @@ +f () +{ + long dx[2055]; + long dy[2055]; + long s1[2055]; + int x, y; + int i; + long s; + + for (;;) + { + s = 2055; + g (s1, s); + for (i = 0; i < 1; i++); + dy[s] = 0x12345; + for (i = 0; i < 1; i++); + if (x != y || h (dx, dy, s) || dx[s] != 0x12345) + { + j (y);k (dy); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-2.c b/gcc/testsuite/gcc.c-torture/compile/921202-2.c new file mode 100644 index 000000000..97d482b63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921202-2.c @@ -0,0 +1,8 @@ +f(x, c) +{ + for (;;) + { + if (x << c) break; + x++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-1.c b/gcc/testsuite/gcc.c-torture/compile/921203-1.c new file mode 100644 index 000000000..50fe3eb0b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921203-1.c @@ -0,0 +1,5 @@ +char dispstr[]; +f() +{ + strcpy(dispstr,"xxxxxxxxxxx"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-2.c b/gcc/testsuite/gcc.c-torture/compile/921203-2.c new file mode 100644 index 000000000..929afb1bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921203-2.c @@ -0,0 +1,13 @@ +typedef struct +{ + char x; +} s1; + +s1 f (int arg0,...) +{ + int args; + s1 back; + va_start (args, arg0); + va_end (args); + return back; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921206-1.c b/gcc/testsuite/gcc.c-torture/compile/921206-1.c new file mode 100644 index 000000000..10fa5ea64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921206-1.c @@ -0,0 +1,28 @@ +double sqrt(double),fabs(double),sin(double); +int sxs; +int sys; +f() +{ + int l; + int sm = -52, sx = 52; + char *smap; + for (l = 0; l < 9; l++) + { + double g; + int cx, cy, gx, gy, x, y; + gx = 2 > g / 3 ? 2 : g / 3; + gy = 2 > g / 3 ? 2 : g / 3; + for (y = 0 > cy - gy ? 0 : cy - gy; y <= (sys - 1 < cy + gy ? sys : cy + gy); y++) + { + int sx = 0 > cx - gx ? 0 : cx - gx; + short *ax = (short *) (y * sxs + sx); + + for (x = sx; x <= (sxs - 1 < cx + gx ? sxs - 1 : cx + gx); x++) + { + double c=2.25, z=sqrt(fabs(1-c)), cz=(c>1?0.0:-10)>z?c>1?0:1:z; + } + } + } + for (l = sm; l <= sx; l++) + smap[l] = l > 0 ? 1 + foo(sin(.1 * l / sx)) : 1 - foo(sin(.1 * l / sm)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921227-1.c b/gcc/testsuite/gcc.c-torture/compile/921227-1.c new file mode 100644 index 000000000..a49750c81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921227-1.c @@ -0,0 +1,5 @@ +#define k(a) #a +char *s = k(k(1,2)); +char *t = k(#) k(#undef k) k(x); + +f(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-1.c b/gcc/testsuite/gcc.c-torture/compile/930109-1.c new file mode 100644 index 000000000..dbd15a1bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930109-1.c @@ -0,0 +1,12 @@ +f(x) + unsigned x; +{ + static short c; + return x>>c; +} +g(x) + unsigned x; +{ + static char c; + return x>>c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-2.c b/gcc/testsuite/gcc.c-torture/compile/930109-2.c new file mode 100644 index 000000000..61e3a4df9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930109-2.c @@ -0,0 +1,11 @@ +f(r) +{ + int i; + for (i = 0; i < 2; i++) + { + r+= (4 >> i*2); + r+= (2 >> i*2); + r+= (1 >> i*2); + } + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930111-1.c b/gcc/testsuite/gcc.c-torture/compile/930111-1.c new file mode 100644 index 000000000..28574191d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930111-1.c @@ -0,0 +1,10 @@ +/* 2.3.3 crashes on 386 with -traditional */ +f(a) + char *a; +{ + int d = strcmp(a,"-"); + + while (vfork() < 0) + ; + return d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930117-1.c b/gcc/testsuite/gcc.c-torture/compile/930117-1.c new file mode 100644 index 000000000..83317cdd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930117-1.c @@ -0,0 +1,4 @@ +f(x) +{ + (*(void (*)())&x)(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930118-1.c b/gcc/testsuite/gcc.c-torture/compile/930118-1.c new file mode 100644 index 000000000..b29543c52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930118-1.c @@ -0,0 +1,6 @@ +f() +{ +__label__ l; +l:p(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/930120-1.c b/gcc/testsuite/gcc.c-torture/compile/930120-1.c new file mode 100644 index 000000000..95ac43c07 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930120-1.c @@ -0,0 +1,138 @@ +union { + short I[2]; + long int L; + char C[4]; +} itolws; +char *errflg; +long int dot; +short dotinc; +long int expvf; + +char * +f(fcount,ifp,itype,ptype) + short fcount; + char *ifp; +{ + unsigned w; + long int savdot, wx; + char *fp; + char c, modifier, longpr; + union { + double dval; + struct { + int i1; + int i2; + } ival; + } dw; + union { + float fval; + int ival; + } fw; + int gotdot = 0; + while (fcount > 0) { + fp = ifp; + c = *fp; + longpr = ((c >= 'A') & (c <= 'Z') | (c == 'f') | (c == '4') | (c == 'p') | (c == 'i')); + if ((itype == 0) || (*fp == 'a')) { + wx = dot; + w = dot; + } else { + gotdot = 1; + wx = get((int)dot, itype); + if (!longpr) { + w = (itolws.L=(wx), itolws.I[((dot)&3)>>1]); + } + } + if (c == 'F') { + dw.ival.i1 = wx; + if (itype == 0) { + dw.ival.i2 = expvf; + } + } + + modifier = *fp++; + switch(modifier) { + case ' ' : + case '\t' : + break; + case 't': + case 'T': + printf("%T",fcount); + return(fp); + case 'r': + case 'R': + printf("%M",fcount); + return(fp); + case 'k': + printf("%k",w); + break; + case 'K': + printf("%K",wx); + break; + case 'a': + psymoff(dot,ptype,":%16t"); + dotinc = 0; + break; + case 'p': + psymoff(0,ptype,"%16t"); + break; + case 'u': + printf("%-8u",w); + break; + case 'U': + printf("%-16U",wx); break; + case 'c': + case 'C': + if (modifier == 'C') { + printesc((int)(itolws.L=(wx), itolws.C[(dot)&3])); + } else { + printc((char)(itolws.L=(wx), itolws.C[(dot)&3])); + } + dotinc = 1; + break; + case 'b': + printf("%-8x", (itolws.L=(wx), itolws.C[(dot)&3])); + dotinc = 1; + break; + case 'B': + printf("%-8o", (itolws.L=(wx), itolws.C[(dot)&3])); + dotinc = 1; + break; + case 's': + case 'S': + savdot = dot; + dotinc = 1; + while ((c = (itolws.L=(wx), itolws.C[(dot)&3])) && (errflg == 0)) { + dot = inkdot(1); + if (modifier == 'S') { + printesc(c); + } else { + printc(c); + } + endline(); + if (!(dot & 3)) + wx = get((int)dot, itype); + } + dotinc = dot - savdot + 1; + dot = savdot; + break; + case 'i': + if (gotdot) { + wx = get((int)(dot & ~3), itype); + } + iDasm((int)(wx), (unsigned int)0, (unsigned int)(dot&~3)); + printc('\n'); + break; + case 'f': + fw.ival = wx; + printf("%-16.9f", fw.fval); + dotinc = 4; + break; + case 'F': + printf("%-32.18F", dw.dval); + dotinc = 8; + break; + } + } + return(fp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930126-1.c b/gcc/testsuite/gcc.c-torture/compile/930126-1.c new file mode 100644 index 000000000..8313c5c45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930126-1.c @@ -0,0 +1,74 @@ +typedef unsigned T; +typedef char Tchar; +T mt (long, char *); +T ms (long, char *); +T mv (long, T, char); +T cons (T, T); +T decl (T * (*) (T *), char *); + +T*L92(T*),*L15(T*),*L14(T*),*L13(T*),*L12(T*),*L11(T*),*L10(T*),*L9(T*),*L8(T*),*L7(T*),*L6(T*),*L5(T*),*L4(T*),*L3(T*),*L2(T*),*L1(T*); + +static T * +Ldata (T * my_pc) +{ +int cc = (((* ((T *) (my_pc))) >> 16) & 0xFF); +T B92, B91, B90, B15, B14, B13, B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, tO7, tO6, tO5, tO4, tO3, tO2, tO1, tO0; +T object = mv (168, 0, ((Tchar) 1)); +T * cb = (T *) (((T) (object & 0x3FF)) | 0x400); +tO0 = mv (92, 0, ((Tchar) 1)); +B92 = decl (L92, ""); +B15 = decl (L15, ""); +B14 = decl (L14, ""); +B13 = decl (L13, ""); +B12 = decl (L12, ""); +B11 = decl (L11, ""); +B10 = decl (L10, ""); +B9 = decl (L9, ""); +B8 = decl (L8, ""); +B7 = decl (L7, ""); +B6 = decl (L6, ""); +B5 = decl (L5, ""); +B4 = decl (L4, ""); +B3 = decl (L3, ""); +B2 = decl (L2, ""); +B1 = decl (L1, ""); +cb[19] = ((((cc) & 0xFF) << 16) | (9 & 0xFF)); +cb[21] = ((((cc) & 0xFF) << 16) | ((10) & 0xFF)); +cb[23] = ((((cc) & 0xFF) << 16) | (11 & 0xFF)); +cb[25] = ((((cc) & 0xFF) << 16) | (12 & 0xFF)); +cb[27] = ((((cc) & 0xFF) << 16) | (13 & 0xFF)); +cb[29] = ((((cc) & 0xFF) << 16) | (14 & 0xFF)); +cb[31] = ((((cc) & 0xFF) << 16) | (15 & 0xFF)); +cb[35] = ((((cc) & 0xFF) << 16) | (17 & 0xFF)); +cb[36] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; +cb[39] = ms (24, ((char *) "")); +cb[41] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; +cb[44] = 3; +cb[46] = 2; +cb[48] = 3; +cb[50] = 6; +cb[52] = 4; +cb[146] = tO0; +((T *) (((tO0 & 0x3FF)) | 0x400))[92] = B1; +((T *) (((tO0 & 0x3FF)) | 0x400))[91] = B2; +((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B90; +((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B91; +((T *) (((tO0 & 0x3FF)) | 0x400))[1] = B92; +cb[58] = 0x2800 | (T) ((T *) ((B6 & 0x3FF) | 0x400) + 3); +cb[57] = 0x2800 | (T) ((T *) ((B7 & 0x3FF) | 0x400) + 3) & ~0xC00; +cb[56] = 0x2800 | (T) ((T *) ((B8 & 0x3FF) | 0x400) + 3) & ~0xC00; +cb[55] = 0x2800 | (T) ((T *) ((B9 & 0x3FF) | 0x400) + 3) & ~0xC00; +tO7 = mv (8, 0, ((Tchar) 1)); +tO4 = ms (9, ((char *) "")); +tO3 = mv (58, 0, ((Tchar) 1)); +tO6 = ms (4, ((char *) "")); +tO2 = mv (4, 0, ((Tchar) 1)); +tO5 = ms (4, ((char *) "")); +tO1 = mv (28, 0, ((Tchar) 1)); +cb[165] = tO1; +cb[163] = cons (((ms (10, ((char *) "")))), (cons (tO5, 0))); +cb[162] = cons (1, (cons (2, 0))); +cb[150] = cons (1, (cons (2, (cons (3, (cons (4, (cons (5, (cons (6, 0))))))))))); +cb[148] = tO7; +return cb; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930210-1.c b/gcc/testsuite/gcc.c-torture/compile/930210-1.c new file mode 100644 index 000000000..47d2da2ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930210-1.c @@ -0,0 +1,11 @@ +f() +{ + char c1, c2; + char *p1, *p2; + + do { + c1 = c2 = *p1++; + while (c1--) + *p2++ = *p1++; + } while (c2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930217-1.c b/gcc/testsuite/gcc.c-torture/compile/930217-1.c new file mode 100644 index 000000000..0f64a0407 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930217-1.c @@ -0,0 +1,20 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else +double g (); +typedef union { + struct { + unsigned s:1, e:8, f:23; + } u; + float f; +} s; + +f(x, n) + float x; +{ + ((s *)&x)->u.e -= n; + x = g((double)x, -n); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930222-1.c b/gcc/testsuite/gcc.c-torture/compile/930222-1.c new file mode 100644 index 000000000..c6d6aa3b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930222-1.c @@ -0,0 +1,16 @@ +typedef struct + { + long i; + double f; + } T; + +f (T *n1, T *n2) +{ + if (g (n2)) + return n1->i - n2->i; + else + { + double f = n1->f - n2->i; + return f == 0.0 ? 0 : (f > 0.0 ? 1 : -1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930325-1.c b/gcc/testsuite/gcc.c-torture/compile/930325-1.c new file mode 100644 index 000000000..24cea5027 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930325-1.c @@ -0,0 +1,23 @@ +typedef unsigned uint; + +inline +g (uint *s, uint *d, uint c) +{ + while (c != 0) + { + *--d = *--s; + c--; + } +} + +f (uint *p1, uint c, uint *p2) +{ + while (c > 0 && *p1 == 0) + { + p1++; + c--; + } + if (c == 0) + return 1; + g (p2, p1, c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930326-1.c b/gcc/testsuite/gcc.c-torture/compile/930326-1.c new file mode 100644 index 000000000..97313d86a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930326-1.c @@ -0,0 +1,6 @@ +struct +{ + char a, b, f[3]; +} s; + +long i = s.f-&s.b; diff --git a/gcc/testsuite/gcc.c-torture/compile/930411-1.c b/gcc/testsuite/gcc.c-torture/compile/930411-1.c new file mode 100644 index 000000000..bb03c13fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930411-1.c @@ -0,0 +1,36 @@ +int heap; + +g(){} + +f(int i1, int i2) +{ + i1 = *(int*)(i1 + 4); + if (i1 == 0) + goto L4; + else + goto L9; + L3: + i2 = heap - 8; + *(int*)i2 = 3; + *(int*)(i2 + 4) = i1; + heap -= 8; + return i2; + L4: + i1 = g(i2); + goto L5; + L5: + i1 = *(int*)(i1 + 4); + if (i1 == 0) + goto L7; + else + goto L8; + L7: + i1 = 0; + goto L3; + L8: + i1 = 1; + goto L3; + L9: + i1 = 1; + goto L3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930421-1.c b/gcc/testsuite/gcc.c-torture/compile/930421-1.c new file mode 100644 index 000000000..01b465f7f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930421-1.c @@ -0,0 +1,19 @@ +double q(double); + +f (int **x, int *r, int *s, int a, int b, int c, int d) +{ + int i, j, k, m, e, f, g, z[1024], y[2]; + + e = g = 0; + for (i = 0; i < a; i++) + for (j = 0; j < b; j++) + if (x[i][j]) + for (k = 0; k < c; k++) + { + f = q(1.5) + q(2.5); + if (g < y[f]) + g = e; + } + for (m = 0; m < 1; m++) + z[0] = m*2*d/3.0 - d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930427-2.c b/gcc/testsuite/gcc.c-torture/compile/930427-2.c new file mode 100644 index 000000000..53b633785 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930427-2.c @@ -0,0 +1,9 @@ +struct s { + int f; +}; + +f (w, v0, v1, v2, v3) + struct s *w; +{ + g (v0 ? 1 : w->f, v1 ? v3 : v2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-1.c b/gcc/testsuite/gcc.c-torture/compile/930503-1.c new file mode 100644 index 000000000..6889e8b7a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930503-1.c @@ -0,0 +1,8 @@ +f (const char *s, char *d, unsigned l) +{ + if (0) + while (1); + else + while (--l >= 0) + *d++ = *s++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-2.c b/gcc/testsuite/gcc.c-torture/compile/930503-2.c new file mode 100644 index 000000000..1b0ea34f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930503-2.c @@ -0,0 +1,5 @@ +f() +{ + struct { char x; } r; + g(r); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-1.c b/gcc/testsuite/gcc.c-torture/compile/930506-1.c new file mode 100644 index 000000000..8c26ea367 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930506-1.c @@ -0,0 +1,12 @@ +long long +f (a) + double a; +{ + double b; + unsigned long long v; + + b = a / 2.0; + v = (unsigned) b; + a -= (double) v; + return v; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-2.c b/gcc/testsuite/gcc.c-torture/compile/930506-2.c new file mode 100644 index 000000000..e11e62f02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930506-2.c @@ -0,0 +1,15 @@ +#ifndef NO_TRAMPOLINES +int f1() +{ + { int ___() { foo(1); } bar(___); } + return( { int ___() { foo(2); } bar(___);} ); +} + +int f2(int j) +{ + { int ___() { foo(j); } bar(___); } + return( { int ___() { foo(j); } bar(___);} ); +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930510-1.c b/gcc/testsuite/gcc.c-torture/compile/930510-1.c new file mode 100644 index 000000000..8c4628262 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930510-1.c @@ -0,0 +1,18 @@ +typedef long time_t; +static __const int mon_lengths[2][12] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; +static time_t +f (janfirst, year, rulep, offset) + __const time_t janfirst; + __const int year; + register __const struct rule * __const rulep; + __const long offset; +{ + register int leapyear; + register time_t value; + register int i; + + value += mon_lengths[leapyear][i] * ((long) (60 * 60) * 24); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-1.c b/gcc/testsuite/gcc.c-torture/compile/930513-1.c new file mode 100644 index 000000000..463fd89b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-1.c @@ -0,0 +1,15 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else +struct s { + int f1 : 26; + int f2 : 8; +}; + +f (struct s *x) +{ + return x->f2++ == 0; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-2.c b/gcc/testsuite/gcc.c-torture/compile/930513-2.c new file mode 100644 index 000000000..a7f508c82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-2.c @@ -0,0 +1,9 @@ +double g (); + +f (x) + double x; +{ + x = .85; + while (g () < x) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-3.c b/gcc/testsuite/gcc.c-torture/compile/930513-3.c new file mode 100644 index 000000000..f8d4e6034 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-3.c @@ -0,0 +1,9 @@ +test () +{ + short *p, q[3]; + int x; + + p = q; + for (x = 0; x < 3; x++) + *p++ = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930523-1.c b/gcc/testsuite/gcc.c-torture/compile/930523-1.c new file mode 100644 index 000000000..5f2b5b5d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930523-1.c @@ -0,0 +1,54 @@ +int v; + +f () +{ + unsigned long *a1, *a2; + int vertex2; + int c, x1, x2, dx1, dx2, dy1, dy2, e1, e2, s2; + unsigned long m, b; + int n; + unsigned long r; + int aba; + + do + { + if (dx2 >= dy2) + dx2 = dx2 % dy2; + + if (dx2 >= dy2) + { + s2 = - (dx2 / dy2); + dx2 = dx2 % dy2; + } + } + while (vertex2 / 65536); + + for (;;) + { + c = x2; + a2 = a1; + if (v) + a2 = 0; + + if (c + n) + { + m = b << (c * 8); + *a2 = (*a2 & ~m) | (r & m); + n += c; + + while (--n) + { + { + } + } + } + + a1 = 0; + x1 += 0; + if (e1 += dx1) + e1 -= dy1; + x2 += s2; + if (e2 += dx2) + e2 -= dy2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930525-1.c b/gcc/testsuite/gcc.c-torture/compile/930525-1.c new file mode 100644 index 000000000..00c2e263b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930525-1.c @@ -0,0 +1,7 @@ +typedef struct foo foo_t; +foo_t x; +struct foo { + int i; +}; + +foo_t x = { 10 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/930527-1.c b/gcc/testsuite/gcc.c-torture/compile/930527-1.c new file mode 100644 index 000000000..53e00e65e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930527-1.c @@ -0,0 +1,16 @@ +enum {e0, e1}; + +int x[] = +{ + [e0] = 0 +}; + +f () +{ + switch (1) + { + case e0: + case e1: + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930529-1.c b/gcc/testsuite/gcc.c-torture/compile/930529-1.c new file mode 100644 index 000000000..70b2cb8f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930529-1.c @@ -0,0 +1,83 @@ +struct r +{ + int d1, d2; +}; + +struct km +{ + int d; +}; + +struct f1 +{ + char *fn; + char *fd; + char *fs; + char *ic; + void (*ff) (); +}; + +int g (); + +int y; +struct r *bs; +int bv; + +void b (); +char *w (); + +struct km **q; +char **mns; +int nm; +struct f1 **z; + +f (char *km, char *h) +{ + struct f1 *t; + int map = midn(km, strlen(km)); + int V; + int c; + struct r r; + struct f1 *cm; + + if (!g(&V, &cm, h, strlen(h))) + { + c = (cm - z[V]); + goto L; + } + + for (c = 0; c < nm; c++) + if (!strcmp (h, mns[c])) + { + V = -1; + goto L; + } + + for (c = 0; c < y; c++) + { + if (!memcmp (&bs[c], &r, 8)) + goto L; + } + + h = w (&r); + if (!bv) + { + bs = g (8); + t = (struct f1 *)g (20); + } + else + { + bs = g (bs, y * 8); + z[bv] = cr (z[bv], (1 + y) * 20); + t = &z[bv][y - 1]; + } + bs[y - 1] = r; + t->fs[0] = sp (y - 1); + t->fs[1] = 0; + t->ic = 0; + t->fd = 0; + t->fn = cs (h); + t->ff = b; + L: + g (q[map], V, c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930530-1.c b/gcc/testsuite/gcc.c-torture/compile/930530-1.c new file mode 100644 index 000000000..848e0400e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930530-1.c @@ -0,0 +1,5 @@ +f () +{ + struct { char a, b; } x; + g (x, x, x, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930602-1.c b/gcc/testsuite/gcc.c-torture/compile/930602-1.c new file mode 100644 index 000000000..5a0eb2189 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930602-1.c @@ -0,0 +1,13 @@ +typedef struct { + int f[8]; +} T; + +f (w, l, r) + T *w; + unsigned short l, r; +{ + int i; + + for (i = l; i < r; i++) + g (w->f[i]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930603-1.c b/gcc/testsuite/gcc.c-torture/compile/930603-1.c new file mode 100644 index 000000000..643cc52d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930603-1.c @@ -0,0 +1,10 @@ +union u { union u *a; double d; }; +union u *s, g(); + +f() +{ + union u x = g(); + + s[0] = *x.a; + s[1] = g(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930607-1.c b/gcc/testsuite/gcc.c-torture/compile/930607-1.c new file mode 100644 index 000000000..97c94b25e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930607-1.c @@ -0,0 +1,9 @@ +typedef void f (); +typedef f *pf; +long long i; + +g () +{ + long long p = i; + ((pf) (long) p) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930611-1.c b/gcc/testsuite/gcc.c-torture/compile/930611-1.c new file mode 100644 index 000000000..c216c0965 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930611-1.c @@ -0,0 +1,7 @@ +float +f (float a1) +{ + union { float f; int l; } fl1; + fl1.f = a1; + return fl1.l ? 1.0 : a1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930618-1.c b/gcc/testsuite/gcc.c-torture/compile/930618-1.c new file mode 100644 index 000000000..74c215725 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930618-1.c @@ -0,0 +1,8 @@ +f (s) +{ + int r; + + r = (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)); + + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930621-1.c b/gcc/testsuite/gcc.c-torture/compile/930621-1.c new file mode 100644 index 000000000..4199bbe08 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930621-1.c @@ -0,0 +1,38 @@ +#if defined(STACK_SIZE) && (STACK_SIZE < 65536) +# define BYTEMEM_SIZE 10000L +#endif + +#ifndef BYTEMEM_SIZE +# define BYTEMEM_SIZE 45000L +#endif + +int bytestart[5000 + 1]; +unsigned char modtext[400 + 1]; +unsigned char bytemem[2][BYTEMEM_SIZE + 1]; + +long +modlookup (int l) +{ + signed char c; + long j; + long k; + signed char w; + long p; + while (p != 0) + { + while ((k < bytestart[p + 2]) && (j <= l) && (modtext[j] == bytemem[w][k])) + { + k = k + 1; + j = j + 1; + } + if (k == bytestart[p + 2]) + if (j > l) + c = 1; + else c = 4; + else if (j > l) + c = 3; + else if (modtext[j] < bytemem[w][k]) + c = 0; + else c = 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930623-1.c b/gcc/testsuite/gcc.c-torture/compile/930623-1.c new file mode 100644 index 000000000..4b5b90bd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930623-1.c @@ -0,0 +1,7 @@ +g (a, b) {} + +f (xx) + void* xx; +{ + __builtin_apply ((void*)g, xx, 200); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930702-1.c b/gcc/testsuite/gcc.c-torture/compile/930702-1.c new file mode 100644 index 000000000..9f51dd876 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930702-1.c @@ -0,0 +1,5 @@ +f () +{ + {({});} + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930926-1.c b/gcc/testsuite/gcc.c-torture/compile/930926-1.c new file mode 100644 index 000000000..fcfa4fbc4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930926-1.c @@ -0,0 +1,7 @@ +int f () { return 0; } + +void +test () +{ + int j = { f() }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930927-1.c b/gcc/testsuite/gcc.c-torture/compile/930927-1.c new file mode 100644 index 000000000..81a4979f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930927-1.c @@ -0,0 +1,3 @@ +#include <stddef.h> + +wchar_t s[5] = L"abcd"; diff --git a/gcc/testsuite/gcc.c-torture/compile/931003-1.c b/gcc/testsuite/gcc.c-torture/compile/931003-1.c new file mode 100644 index 000000000..922b14379 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931003-1.c @@ -0,0 +1,15 @@ +f (n, a) + int n; + double a[]; +{ + double b[51]; + int i, j; + + i = 0; + + for (j = n - 1; j > 0; j--) + b[i++] = 0; + + if (b[0] > b[i - 1]) + a[i] = b[i - 1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931004-1.c b/gcc/testsuite/gcc.c-torture/compile/931004-1.c new file mode 100644 index 000000000..0e741fd4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931004-1.c @@ -0,0 +1,8 @@ +#define A "This is a long test that tests the structure initialization" +#define B A,A +#define C B,B,B,B +#define D C,C,C,C +int main() +{ + char *subs[]={ D, D, D, D, D, D, D, D, D, D, D, D, D, D, D}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-1.c b/gcc/testsuite/gcc.c-torture/compile/931013-1.c new file mode 100644 index 000000000..c237c0b73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-1.c @@ -0,0 +1,10 @@ +g (); + +f () +{ + long ldata[2]; + int seed; + + seed = (ldata[0]) + (ldata[1] << 16); + g (seed); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-2.c b/gcc/testsuite/gcc.c-torture/compile/931013-2.c new file mode 100644 index 000000000..8fc0db492 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-2.c @@ -0,0 +1,20 @@ +f (unsigned short Z[48]) +{ + int j; + unsigned short t1, t2, t3, T[48]; + unsigned short *p = T + 48; + + for (j = 1; j < 8; j++) + { + t1 = *Z++; + *--p = *Z++; + *--p = t1; + t1 = inv(*Z++); + t2 = -*Z++; + t3 = -*Z++; + *--p = inv(*Z++); + *--p = t2; + *--p = t3; + *--p = t1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-3.c b/gcc/testsuite/gcc.c-torture/compile/931013-3.c new file mode 100644 index 000000000..e663b9acc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-3.c @@ -0,0 +1,11 @@ +struct s +{ + int f; +}; + +struct s +f () +{ + int addr; + return *(struct s *) &addr; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931018-1.c b/gcc/testsuite/gcc.c-torture/compile/931018-1.c new file mode 100644 index 000000000..7efe40ec0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931018-1.c @@ -0,0 +1,14 @@ +typedef struct +{ + int a, b; +} T; + +f (T *bs) +{ + long long x; + x = ({ + union { T s; long long l; } u; + u.s = *bs; + u.l; + }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931031-1.c b/gcc/testsuite/gcc.c-torture/compile/931031-1.c new file mode 100644 index 000000000..9015f54f7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931031-1.c @@ -0,0 +1,9 @@ +struct s +{ + int pad:1, no:1; +}; + +f (struct s *b, int c) +{ + char d = b->no && c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-1.c b/gcc/testsuite/gcc.c-torture/compile/931102-1.c new file mode 100644 index 000000000..a039c2633 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931102-1.c @@ -0,0 +1,111 @@ +char *e (); + +#define SET \ + if (d > *b++) d |= a; \ + if (b) b = e(b); + +xxx() +{ + int a, d; + char *b, *c; + + while (1) { + while (1) { + while (1) { + if (a) { + switch (a) { + case 1: + while (1) { + SET + do { + SET + } while (1); + } + case 2: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 3: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 4: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + } + } + else { + switch (a) { + case 2: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 3: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 4: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + } + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-2.c b/gcc/testsuite/gcc.c-torture/compile/931102-2.c new file mode 100644 index 000000000..f39b27164 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931102-2.c @@ -0,0 +1,21 @@ +typedef struct { + int a; +} VCR; + +typedef struct { + VCR vcr[8]; +} VCRC; + +typedef struct { + char vcr; +} OWN; + +OWN Own[16]; + +f (x, own) + VCRC *x; + OWN *own; +{ + x[own->vcr / 8].vcr[own->vcr % 8].a--; + x[own->vcr / 8].vcr[own->vcr % 8].a = x[own->vcr / 8].vcr[own->vcr % 8].a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931203-1.c b/gcc/testsuite/gcc.c-torture/compile/931203-1.c new file mode 100644 index 000000000..3007ff582 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931203-1.c @@ -0,0 +1,5 @@ +v (a, i) + unsigned *a, i; +{ + a++[i] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940611-1.c b/gcc/testsuite/gcc.c-torture/compile/940611-1.c new file mode 100644 index 000000000..90f72486a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940611-1.c @@ -0,0 +1,10 @@ +f () +{ + do +L:; + while (0); + do + ; + while (0); + goto L; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940712-1.c b/gcc/testsuite/gcc.c-torture/compile/940712-1.c new file mode 100644 index 000000000..10a6961dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940712-1.c @@ -0,0 +1,4 @@ +f () +{ + return (*(volatile unsigned int *)8000) / 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940718-1.c b/gcc/testsuite/gcc.c-torture/compile/940718-1.c new file mode 100644 index 000000000..505280fa9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940718-1.c @@ -0,0 +1,7 @@ +extern double log (double) __attribute__ ((const)); + +f (double x) +{ + for (;;) + exp(log(x)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-1.c b/gcc/testsuite/gcc.c-torture/compile/941014-1.c new file mode 100644 index 000000000..d31701572 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-1.c @@ -0,0 +1,11 @@ +f (to) + char *to; +{ + unsigned int wch; + register length; + unsigned char tmp; + unsigned int mult = 10; + + tmp = (wch>>(unsigned int)(length * mult)); + *to++ = (unsigned char)tmp; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-2.c b/gcc/testsuite/gcc.c-torture/compile/941014-2.c new file mode 100644 index 000000000..01e9a672e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-2.c @@ -0,0 +1,37 @@ +void +f (n, ppt, xrot) +{ + int tileWidth; + int nlwSrc; + int srcx; + int v3, v4; + register unsigned long ca1, cx1, ca2, cx2; + unsigned long *pSrcLine; + register unsigned long *pDst; + register unsigned long *pSrc; + register unsigned long b, tmp; + unsigned long tileEndMask; + int v1, v2; + int tileEndPart; + int needFirst; + tileEndPart = 0; + v1 = tileEndPart << 5; + v2 = 32 - v1; + while (n--) + { + if ((srcx = (ppt - xrot) % tileWidth) < 0) + if (needFirst) + if (nlwSrc == 1) + { + tmp = b; + if (tileEndPart) + b = (*pSrc & tileEndMask) | (*pSrcLine >> v1); + } + if (tileEndPart) + b = (tmp << v1) | (b >> v2); + if (v4 != 32) + *pDst = (*pDst & ((tmp << v3) | (b >> v4) & ca1 ^ cx1) + ^ (((tmp << v3) | (b >> v4)) & ca2 ^ cx2)); + *pDst = *pDst & tmp; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-3.c b/gcc/testsuite/gcc.c-torture/compile/941014-3.c new file mode 100644 index 000000000..6dcb89395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-3.c @@ -0,0 +1,72 @@ +typedef unsigned char byte; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef ulong gs_char; +typedef struct gs_show_enum_s gs_show_enum; +typedef struct gs_font_s gs_font; +typedef struct gx_font_stack_item_s { + gs_font *font; +} gx_font_stack_item; +typedef struct gx_font_stack_s { + gx_font_stack_item items[1 + 5 ]; +} gx_font_stack; +struct gs_show_enum_s { + gx_font_stack fstack; +}; +typedef enum { + ft_composite = 0, +} font_type; +struct gs_font_s { + font_type FontType; +}; +typedef enum { + fmap_escape = 3, + fmap_shift = 8 + } fmap_type; +typedef struct gs_type0_data_s { + fmap_type FMapType; +} gs_type0_data; +gs_type0_next_char(register gs_show_enum *penum) +{ + const byte *p; + int fdepth; + gs_font *pfont; + gs_type0_data *pdata; + uint fidx; + gs_char chr; + for (; pfont->FontType == ft_composite; ) + { + fmap_type fmt; + switch ( fmt ) + { + do {} while (0); + rdown: + continue; + case fmap_shift: + p++; + do {} while (0); + goto rdown; + } + break; + } + up: + while ( fdepth > 0 ) + { + switch ( pdata->FMapType ) + { + default: + continue; + case fmap_escape: + fidx = *++p; + do {} while (0); + if ( fidx == chr && fdepth > 1 ) + goto up; + down: + fdepth--; + do {} while (0); + } + break; + } + while ( (pfont = penum->fstack.items[fdepth].font)->FontType == ft_composite ) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-4.c b/gcc/testsuite/gcc.c-torture/compile/941014-4.c new file mode 100644 index 000000000..9e673f378 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-4.c @@ -0,0 +1,16 @@ +#ifndef NO_LABEL_VALUES +f (int *re) +{ + int *loops = 0, *loope = 0; + unsigned dat0 = 0; + static void *debug = &&firstdebug; + + firstdebug: + g (loops, loope); + + if (dat0 & 1) + re[(dat0 >> 2) & 3] = 0; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/941019-1.c b/gcc/testsuite/gcc.c-torture/compile/941019-1.c new file mode 100644 index 000000000..257b594c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941019-1.c @@ -0,0 +1 @@ +__complex__ long double sub (__complex__ long double cld) { return cld; } diff --git a/gcc/testsuite/gcc.c-torture/compile/941111-1.c b/gcc/testsuite/gcc.c-torture/compile/941111-1.c new file mode 100644 index 000000000..3f0c28bef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941111-1.c @@ -0,0 +1,8 @@ +main () +{ + struct S { int i; char c; } obj1, obj2; + + foo (); + if (obj1.c != obj2.c) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941113-1.c b/gcc/testsuite/gcc.c-torture/compile/941113-1.c new file mode 100644 index 000000000..5c2e0b68c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941113-1.c @@ -0,0 +1,12 @@ +typedef void foo (void); + +f (x) +{ + if (x) + { + const foo* v; + (*v)(); + } + else + g (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950122-1.c b/gcc/testsuite/gcc.c-torture/compile/950122-1.c new file mode 100644 index 000000000..8dea79050 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950122-1.c @@ -0,0 +1,5 @@ +int +foo (int i, unsigned short j) +{ + return j *= i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950124-1.c b/gcc/testsuite/gcc.c-torture/compile/950124-1.c new file mode 100644 index 000000000..e723954a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950124-1.c @@ -0,0 +1,15 @@ +f () +{ + if (g ()) + h (); + else + { + do + { + return 0; + break; + } + while (1); + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950221-1.c b/gcc/testsuite/gcc.c-torture/compile/950221-1.c new file mode 100644 index 000000000..141476386 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950221-1.c @@ -0,0 +1,16 @@ +short v = -1; + +typedef struct +{ + short network; +} atype; + +void f () +{ + static atype config; + atype *cp; + short net; + cp = &config; + cp->network = (v == -1) ? 100 : v; + net = cp->network; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950329-1.c b/gcc/testsuite/gcc.c-torture/compile/950329-1.c new file mode 100644 index 000000000..7c047f5a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950329-1.c @@ -0,0 +1,19 @@ +f () +{ + int i; + for (i = 1;; i = 0) + { + if (h ()) + { + if (i) + g (); + g (h ()); + g (h ()); + } + else + { + g (); + break; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950512-1.c b/gcc/testsuite/gcc.c-torture/compile/950512-1.c new file mode 100644 index 000000000..e43ec48d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950512-1.c @@ -0,0 +1,6 @@ +typedef unsigned short uint16; +f (unsigned char *w) +{ + w[2] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) & 0xFF, + w[3] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) >> 8; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950530-1.c b/gcc/testsuite/gcc.c-torture/compile/950530-1.c new file mode 100644 index 000000000..2b714e059 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950530-1.c @@ -0,0 +1,4 @@ +f (int *s, int *t) +{ + return (t - s) / 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950607-1.c b/gcc/testsuite/gcc.c-torture/compile/950607-1.c new file mode 100644 index 000000000..851defce3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950607-1.c @@ -0,0 +1,38 @@ +typedef struct { + int component_id; + int component_index; + int h_samp_factor; + int v_samp_factor; +} jpeg_component_info; +struct jpeg_common_struct { + struct jpeg_error_mgr * err; +}; +typedef struct jpeg_common_struct * j_common_ptr; +typedef struct jpeg_compress_struct * j_compress_ptr; +struct jpeg_compress_struct { + struct jpeg_error_mgr * err; + int num_components; + jpeg_component_info * comp_info; + int max_h_samp_factor; + int max_v_samp_factor; +}; +struct jpeg_error_mgr { + int msg_code; +}; + +void +jinit_downsampler (j_compress_ptr cinfo) +{ + int ci; + jpeg_component_info * compptr; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->h_samp_factor == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) { + } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { + } else + cinfo->err->msg_code = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950610-1.c b/gcc/testsuite/gcc.c-torture/compile/950610-1.c new file mode 100644 index 000000000..16d0d0e60 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950610-1.c @@ -0,0 +1 @@ +f (int n, int a[2][n]) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/950612-1.c b/gcc/testsuite/gcc.c-torture/compile/950612-1.c new file mode 100644 index 000000000..cb3cb0a59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950612-1.c @@ -0,0 +1,134 @@ +typedef enum +{ + LODI, + STO, + ADDI, + ADD, + SUBI, + SUB, + MULI, + MUL, + DIVI, + DIV, + INC, + DEC +} INSN; + +f (pc) + short *pc; +{ + long long stack[16], *sp = &stack[16], acc = 0; + + for (;;) + { + switch ((INSN)*pc++) + { + case LODI: + *--sp = acc; + acc = ((long long)*pc++) << 32; + break; + case STO: + return (acc >> 32) + (((((unsigned long long) acc) & 0xffffffff) & (1 << 31)) != 0); + break; + case ADDI: + acc += ((long long)*pc++) << 32; + break; + case ADD: + acc = *sp++ + acc; + break; + case SUBI: + acc -= ((long long)*pc++) << 32; + break; + case SUB: + acc = *sp++ - acc; + break; + case MULI: + acc *= *pc++; + break; + case MUL: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + acc = ((((((unsigned long long) acc) & 0xffffffff) * (((unsigned long long) aux) & 0xffffffff)) >> 32) + + ((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) & 0xffffffff) + (((unsigned long long) acc) & 0xffffffff) + (((unsigned long long) aux) >> 32)) + + (((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) >> 32)) << 32)); + if (minus) + acc = -acc; + } + break; + case DIVI: + { + short aux; + + aux = *pc++; + acc = (acc + aux / 2) / aux; + } + break; + case DIV: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + + if (((unsigned long long)acc) == 0) + acc = (unsigned long long)-1 / 2; + else if ((((unsigned long long) ((unsigned long long)acc)) & 0xffffffff) == 0) + acc = ((unsigned long long)aux) / (((unsigned long long) ((unsigned long long)acc)) >> 32); + else if ((((unsigned long long) ((unsigned long long)acc)) >> 32) == 0) + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + ((((unsigned long long)aux) % ((unsigned long long)acc)) << 32) / ((unsigned long long)acc); + else + { + unsigned char shift; + unsigned long hi; + + shift = 32; + hi = (((unsigned long long) ((unsigned long long)acc)) >> 32); + do { + if (hi & ((unsigned long)1 << (shift - 1))) + break; + } while (--shift != 0); + printf("shift = %d\n", shift); + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + (((((unsigned long long)aux) % ((unsigned long long)acc)) << (32 - shift)) + ((((unsigned long long)acc) >> shift) / 2)) / (((unsigned long long)acc) >> shift); + } + + if (minus) + acc = -acc; + } + break; + case INC: + acc += 1; + break; + case DEC: + acc -= 1; + break; + } + printf("%08lx.%08lx\n", (long)(((unsigned long long) acc) >> 32) , (long)(((unsigned long long) acc) & 0xffffffff)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950613-1.c b/gcc/testsuite/gcc.c-torture/compile/950613-1.c new file mode 100644 index 000000000..8aa757f47 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950613-1.c @@ -0,0 +1,31 @@ +#ifndef NO_LABEL_VALUES +f () +{ + long *sp; + long *pc; + + static void *dummy[] = + { + &&L1, + &&L2, + }; + + L1: + { + float val; + val = *(float *) sp; + val = -val; + *(float *) sp = val; + goto *pc++; + } + + L2: + { + float from; + *(long long *) sp = from; + goto *pc++; + } +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/950618-1.c b/gcc/testsuite/gcc.c-torture/compile/950618-1.c new file mode 100644 index 000000000..4229da4e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950618-1.c @@ -0,0 +1,2 @@ +static __inline__ int f () { return g (); } +int g () { return f (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/950719-1.c b/gcc/testsuite/gcc.c-torture/compile/950719-1.c new file mode 100644 index 000000000..d3277fada --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950719-1.c @@ -0,0 +1,11 @@ +typedef struct +{ + int Header; + char data[4092]; +} t_node; + +f (unsigned short rid, unsigned short record_length) +{ + t_node tnode; + g (rid, tnode.data + rid * record_length); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950729-1.c b/gcc/testsuite/gcc.c-torture/compile/950729-1.c new file mode 100644 index 000000000..cfdbad920 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950729-1.c @@ -0,0 +1,39 @@ +static const char * const lcset = "0123456789abcdef"; +static const char * const ucset = "0123456789ABCDEF"; + +char * +f (char *buffer, long long value, char type) +{ + int base, i; + + i = 128 - 1; + buffer[i--] = '\0'; + + switch (type) + { + case 'u': + case 'o': + case 'x': + case 'X': + if (type == 'u') + base = 10; + else if (type == 'o') + base = 8; + else + base = 16; + + while (i >= 0) + { + if (type == 'X') + buffer[i--] = ucset[((unsigned long long) value) % base]; + else + buffer[i--] = lcset[((unsigned long long) value) % base]; + + if ((value = ((unsigned long long) value) / base) == 0) + break; + } + break; + } + + return &buffer[++i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-1.c b/gcc/testsuite/gcc.c-torture/compile/950816-1.c new file mode 100644 index 000000000..da849bbad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-1.c @@ -0,0 +1,7 @@ +f () +{ + unsigned char b[2]; + float f; + b[0] = (unsigned char) f / 256; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-2.c b/gcc/testsuite/gcc.c-torture/compile/950816-2.c new file mode 100644 index 000000000..41e770d17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-2.c @@ -0,0 +1,8 @@ +f () +{ + int i; + float a,b,c; + unsigned char val[2]; + i = func (&c); + val[0] = c < a ? a : c >= 1.0 ? b : c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-3.c b/gcc/testsuite/gcc.c-torture/compile/950816-3.c new file mode 100644 index 000000000..b3cb0fca3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-3.c @@ -0,0 +1,8 @@ +f () +{ + int i; + short x, z; + for (i = 0; i <= 1; i++) + x = i; + return x + z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950910-1.c b/gcc/testsuite/gcc.c-torture/compile/950910-1.c new file mode 100644 index 000000000..1be2aa55e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950910-1.c @@ -0,0 +1,22 @@ +f (char *p) +{ + char c; + + c = *++p; + if (c != ' ') + return 0; + for (;;) + { + c = *p; + if (g (c)) + p++; + else + { + if (c == ' ') + break; + else + return 0; + } + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950919-1.c b/gcc/testsuite/gcc.c-torture/compile/950919-1.c new file mode 100644 index 000000000..8320f6d02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950919-1.c @@ -0,0 +1,5 @@ +#define empty +#if empty#cpu(m68k) +#endif + +f (){} diff --git a/gcc/testsuite/gcc.c-torture/compile/950921-1.c b/gcc/testsuite/gcc.c-torture/compile/950921-1.c new file mode 100644 index 000000000..371c7d569 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950921-1.c @@ -0,0 +1,12 @@ +f () +{ + union + { + signed char c; + double d; + } u; + + u.c = 1; + u.c = 1; + return u.c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950922-1.c b/gcc/testsuite/gcc.c-torture/compile/950922-1.c new file mode 100644 index 000000000..73c52f774 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950922-1.c @@ -0,0 +1,68 @@ +struct sw { + const void *x; + int r; +}; +struct sq { + struct sw *q_w; + int t; + int z; +}; + +int +f (int ch, char *fp, char *ap) +{ + register int n; + register char *cp; + register struct sw *p; + register int f; + int prec; + double _double; + int expt; + int ndig; + char expstr[7]; + unsigned long long _uquad; + struct sq q; + struct sw w[8]; + static char zeroes[16]; + + for (;;) { + switch (ch) { + case 'd': + _double = (double) (ap += 8, *((double *) (ap - 8))); + break; + case 'o': + goto nosign; + case 'u': + _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); + goto nosign; + case 'x': + _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(unsigned short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); + nosign: + if (_uquad != 0 || prec != 0); + break; + default:; + } + if ((f & 0x100) == 0) { + } else { + if (ch >= 'f') { + if (_double == 0) { + if (expt < ndig || (f & 0x001) != 0) { + { if ((n = (ndig - 1)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }}}} + } + } else if (expt <= 0) { + { p->x = ("0"); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { p->x = 0; p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { if ((n = (-expt)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} }} + { p->x = cp; p->r = ndig; q.z += ndig; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + } else { + { p->x = cp; p->r = expt; q.z += expt; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + cp += expt; + { p->x = ("."); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { p->x = cp; p->r = (ndig-expt); q.z += (ndig-expt); p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + } + } + } + } + + error:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951004-1.c b/gcc/testsuite/gcc.c-torture/compile/951004-1.c new file mode 100644 index 000000000..1ca60819c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951004-1.c @@ -0,0 +1,23 @@ +typedef struct +{ + short v, h; +} S; + +S a; + +f (S pnt) +{ + S mpnt, mtp; + + (&pnt)->v -= 1; + mpnt = pnt; + mtp = a; + if (mtp.v != mpnt.v) + { + S tpnt; + + tpnt = mtp; + mtp = mpnt; + mpnt = tpnt; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951106-1.c b/gcc/testsuite/gcc.c-torture/compile/951106-1.c new file mode 100644 index 000000000..09cba20c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951106-1.c @@ -0,0 +1,4 @@ +f (double a, double b) +{ + g (a, 0, b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951116-1.c b/gcc/testsuite/gcc.c-torture/compile/951116-1.c new file mode 100644 index 000000000..100d6902a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951116-1.c @@ -0,0 +1,9 @@ +f () +{ + long long i; + int j; + long long k = i = j; + + int inner () {return j + i;} + return k; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951128-1.c b/gcc/testsuite/gcc.c-torture/compile/951128-1.c new file mode 100644 index 000000000..5e4dc7093 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951128-1.c @@ -0,0 +1,5 @@ +char a[]; +f (const int i) +{ + a[i] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951220-1.c b/gcc/testsuite/gcc.c-torture/compile/951220-1.c new file mode 100644 index 000000000..33e98f622 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951220-1.c @@ -0,0 +1,4 @@ +f (char *x) +{ + return (*x & 2) || (*x & 3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951222-1.c b/gcc/testsuite/gcc.c-torture/compile/951222-1.c new file mode 100644 index 000000000..b8246f5fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951222-1.c @@ -0,0 +1,15 @@ +extern long long foo (); + +long long +sub1 () +{ + char junk[10000]; + register long long a, b, c; + + b = foo (); + + setjmp (); + a = foo (); + c = a - b; + return c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960106-1.c b/gcc/testsuite/gcc.c-torture/compile/960106-1.c new file mode 100644 index 000000000..c8228aab5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960106-1.c @@ -0,0 +1,4 @@ +f (a) +{ + return (a & 1) && !(a & 2 & 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960130-1.c b/gcc/testsuite/gcc.c-torture/compile/960130-1.c new file mode 100644 index 000000000..ed8dab459 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960130-1.c @@ -0,0 +1,8 @@ +int a[1]; + +int +main() +{ + extern int a[]; + return *a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960201-1.c b/gcc/testsuite/gcc.c-torture/compile/960201-1.c new file mode 100644 index 000000000..adc462389 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960201-1.c @@ -0,0 +1,5 @@ +union foo +{ + char a; + int x[2]; +} __attribute__ ((transparent_union)); diff --git a/gcc/testsuite/gcc.c-torture/compile/960218-1.c b/gcc/testsuite/gcc.c-torture/compile/960218-1.c new file mode 100644 index 000000000..46fbf7785 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960218-1.c @@ -0,0 +1,2 @@ +#define X(x) x +int main() { return X(0/* *//* */); } diff --git a/gcc/testsuite/gcc.c-torture/compile/960220-1.c b/gcc/testsuite/gcc.c-torture/compile/960220-1.c new file mode 100644 index 000000000..766a066c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960220-1.c @@ -0,0 +1,6 @@ +f () +{ + unsigned long long int a = 0, b; + while (b > a) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960221-1.c b/gcc/testsuite/gcc.c-torture/compile/960221-1.c new file mode 100644 index 000000000..0e02496c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960221-1.c @@ -0,0 +1,11 @@ +struct s1 { int f1; }; + +struct s2 { + struct s1 a; + int f2; +}; + +foo (struct s2 *ptr) +{ + *ptr = (struct s2) {{}, 0}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960319-1.c b/gcc/testsuite/gcc.c-torture/compile/960319-1.c new file mode 100644 index 000000000..f3d95ab6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960319-1.c @@ -0,0 +1,10 @@ +static void +f() +{ + long long a[2]; + int i; + if (g()) + if (h()) + ; + *a |= (long long)i << 65 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960514-1.c b/gcc/testsuite/gcc.c-torture/compile/960514-1.c new file mode 100644 index 000000000..1d38cfd1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960514-1.c @@ -0,0 +1,12 @@ +struct s { + unsigned long long t[5]; +}; + +void +f (struct s *d, unsigned long long *l) +{ + int i; + + for (i = 0; i < 5; i++) + d->t[i] += l[i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960704-1.c b/gcc/testsuite/gcc.c-torture/compile/960704-1.c new file mode 100644 index 000000000..5a9d35cfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960704-1.c @@ -0,0 +1,10 @@ +struct A { + double d; +}; + +struct A f (); + +main () +{ + struct A a = f(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960829-1.c b/gcc/testsuite/gcc.c-torture/compile/960829-1.c new file mode 100644 index 000000000..8c6163dfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960829-1.c @@ -0,0 +1,4 @@ +f () +{ + g (0, 0.0, 0.0, 0.0, 0.0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961004-1.c b/gcc/testsuite/gcc.c-torture/compile/961004-1.c new file mode 100644 index 000000000..6407b625d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961004-1.c @@ -0,0 +1,37 @@ +void +f1 (o1, o2, o3, i, j, k) + long long *o1, *o2, *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] + o3[k >>= 1]; +} + +void +f2 (o1, o2, o3, i, j, k) + long long *o1, *o2, *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] - o3[k >>= 1]; +} + +void +f3 (o1, o2, o3, i, j, k) + long long *o1, *o3; + unsigned *o2; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] + o3[k >>= 1]; +} + +void +f4 (o1, o2, o3, i, j, k) + long long *o1, *o2; + unsigned *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] - o3[k >>= 1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961010-1.c b/gcc/testsuite/gcc.c-torture/compile/961010-1.c new file mode 100644 index 000000000..d6145bc42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961010-1.c @@ -0,0 +1 @@ +double f (double x) { return x == 0 ? x : 0.0; } diff --git a/gcc/testsuite/gcc.c-torture/compile/961019-1.c b/gcc/testsuite/gcc.c-torture/compile/961019-1.c new file mode 100644 index 000000000..0ea6ec6e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961019-1.c @@ -0,0 +1,11 @@ +char _hex_value[256]; + +void +hex_init () +{ + int i; + for (i = 0; i < 256; i++) + _hex_value[i] = 99; + for (i = 0; i < 10; i++) + _hex_value['0' + i] = i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961031-1.c b/gcc/testsuite/gcc.c-torture/compile/961031-1.c new file mode 100644 index 000000000..ea8718f76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961031-1.c @@ -0,0 +1,16 @@ +struct s { + double d; +} sd; + +struct s g () __attribute__ ((const)); + +struct s +g () +{ + return sd; +} + +f () +{ + g (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961126-1.c b/gcc/testsuite/gcc.c-torture/compile/961126-1.c new file mode 100644 index 000000000..f3b6af555 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961126-1.c @@ -0,0 +1,107 @@ +int *p; + +main() +{ + int i = sub (); + + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + + i = -i; +quit: + sub2 (i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.c b/gcc/testsuite/gcc.c-torture/compile/961203-1.c new file mode 100644 index 000000000..989085843 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961203-1.c @@ -0,0 +1,22 @@ +/* The structure is too large for the xstormy16 - won't fit in 16 + bits. */ +/* { dg-do assemble } */ + +#if __INT_MAX__ >= 2147483647L +struct s { + char a[0x32100000]; + int x:30, y:30; +}; + +int +main () +{ + struct s* p; + + p = (struct s*) 0; + if (p->x == p->y) + exit (1); +} +#else +int g; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/970206-1.c b/gcc/testsuite/gcc.c-torture/compile/970206-1.c new file mode 100644 index 000000000..95196cd6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/970206-1.c @@ -0,0 +1,13 @@ +struct Rect +{ + int iA; + int iB; + int iC; + int iD; +}; + +void +f (int * const this, struct Rect arect) +{ + g (*this, arect); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/970214-1.c b/gcc/testsuite/gcc.c-torture/compile/970214-1.c new file mode 100644 index 000000000..508ea9e92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/970214-1.c @@ -0,0 +1,3 @@ +#include <stddef.h> +#define L 264 +wchar_t c = L'X'; diff --git a/gcc/testsuite/gcc.c-torture/compile/980329-1.c b/gcc/testsuite/gcc.c-torture/compile/980329-1.c new file mode 100644 index 000000000..3b3fe27cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980329-1.c @@ -0,0 +1,72 @@ +typedef __SIZE_TYPE__ size_t; +struct re_pattern_buffer + { + unsigned char *buffer; + unsigned long int used; + }; +struct re_registers + { + int *start; + }; + +static const char **regstart, **regend; +static const char **old_regend; + +static int +re_match_2_internal (struct re_pattern_buffer *bufp, + struct re_registers *regs) +{ + unsigned char *p = bufp->buffer; + unsigned char *pend = p + bufp->used; + + for (;;) + { + int highest_active_reg = 1; + if (bufp) + { + int i; + for (i = 1;; i++) + regs->start[i] = 0; + } + + switch ((unsigned int) *p++) + { + case 1: + { + unsigned char r = *p; + if (r) + highest_active_reg = r; + } + if (p + 2 == pend) + { + char is_a_jump_n = 0; + int mcnt = 0; + unsigned char *p1; + + p1 = p + 2; + switch (*p1++) + { + case 2: + is_a_jump_n = 1; + case 1: + do { do { mcnt = *p1; } while (0); p1 += 2; } while (0); + if (is_a_jump_n) + p1 = 0; + } + + if (mcnt && *p1 == 0) + { + unsigned r; + for (r = 0; r < (unsigned) *p + (unsigned) *(p + 1); r++) + { + if (regend[0] >= regstart[r]) + regend[r] = old_regend[r]; + } + do { while (0 < highest_active_reg + 1) { } } while (0); + } + } + } + } + + return -1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980408-1.c b/gcc/testsuite/gcc.c-torture/compile/980408-1.c new file mode 100644 index 000000000..09bf43040 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980408-1.c @@ -0,0 +1,129 @@ +typedef struct _RunlengthPacket +{ + unsigned short + red, + green, + blue, + length; + unsigned short + index; +} RunlengthPacket; +typedef struct _Image +{ + int + status, + temporary; + char + filename[1664 ]; + long int + filesize; + int + pipe; + char + magick[1664 ], + *comments, + *label, + *text; + unsigned int + matte; + unsigned int + columns, + rows, + depth; + unsigned int + scene, + number_scenes; + char + *montage, + *directory; + unsigned int + colors; + double + gamma; + float + x_resolution, + y_resolution; + unsigned int + mean_error_per_pixel; + double + normalized_mean_error, + normalized_maximum_error; + unsigned long + total_colors; + char + *signature; + unsigned int + packets, + runlength, + packet_size; + unsigned char + *packed_pixels; + long int + magick_time; + char + magick_filename[1664 ]; + unsigned int + magick_columns, + magick_rows; + char + *geometry, + *page; + unsigned int + dispose, + delay, + iterations; + unsigned int + orphan; + struct _Image + *previous, + *list, + *next; +} Image; + Image *MinifyImage(Image *image) +{ + Image + *minified_image; + register RunlengthPacket + *q, + *s, + *s0, + *s1, + *s2, + *s3; + register unsigned int + x; + unsigned int + blue, + green, + red; + unsigned long + total_matte, + total_blue, + total_green, + total_red; + unsigned short + index; + for (x=0; x < (image->columns-1); x+=2) + { + total_red=0; + total_green=0; + total_blue=0; + total_matte=0; + s=s0; + total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; + s=s1; + total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; + s=s2; + total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; + s=s3; + total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; + red=(unsigned short) ((total_red+63) >> 7); + green=(unsigned short) ((total_green+63) >> 7); + blue=(unsigned short) ((total_blue+63) >> 7); + index=(unsigned short) ((total_matte+63) >> 7); + if ((red == q->red) && (green == q->green) && (blue == q->blue) && + (index == q->index) && ((int) q->length < 65535L )) + q->length++; + } + return(minified_image); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980504-1.c b/gcc/testsuite/gcc.c-torture/compile/980504-1.c new file mode 100644 index 000000000..7b757ccd2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980504-1.c @@ -0,0 +1,28 @@ +typedef struct _geom_elem { + double coeffs[6]; +} pGeomDefRec, *pGeomDefPtr; +typedef struct _mpgeombanddef { + int yOut; + int in_width; +} mpGeometryBandRec, *mpGeometryBandPtr; +typedef void *pointer; +typedef unsigned char CARD8; +typedef CARD8 BytePixel; +void BiGL_B (OUTP,srcimg,width,sline,pedpvt,pvtband) pointer OUTP; +pointer *srcimg; +register int width; +int sline; +pGeomDefPtr pedpvt; mpGeometryBandPtr pvtband; +{ + register float s, t, st; + register int isrcline,isrcpix; + register int srcwidth = pvtband->in_width - 1; + register BytePixel val; + register BytePixel *ptrIn, *ptrJn; + register double a = pedpvt->coeffs[0]; + register double c = pedpvt->coeffs[2]; + register double srcpix = a * ((double)(0.0000)) + pedpvt->coeffs[1] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[4]; + register double srcline = c * ((double)(0.0000)) + pedpvt->coeffs[3] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[5]; + if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) + val = ptrIn[isrcpix] * ((float)1. - s - t + st) + ptrIn[isrcpix+1] * (s - st) + ptrJn[isrcpix] * (t - st) + ptrJn[isrcpix+1] * (st) + (float)0.5 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.c b/gcc/testsuite/gcc.c-torture/compile/980506-1.c new file mode 100644 index 000000000..5c22e7e50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980506-1.c @@ -0,0 +1,70 @@ +/* The arrays are too large for the xstormy16 - won't fit in 16 bits. */ +/* { dg-do assemble } */ +/* { dg-require-effective-target size32plus } */ +/* { dg-xfail-if "The array too big" { m6811-*-* m6812-*-* } { "*" } { "" } } /* +/* { dg-skip-if "Array too big" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-xfail-if "The array too big" { h8300-*-* } { "-mno-h" "-mn" } { "" } } */ + +unsigned char TIFFFax2DMode[20][256]; +unsigned char TIFFFax2DNextState[20][256]; +unsigned char TIFFFaxUncompAction[20][256]; +unsigned char TIFFFaxUncompNextState[20][256]; +unsigned char TIFFFax1DAction[230][256]; +unsigned char TIFFFax1DNextState[230][256]; + +typedef struct tableentry { + unsigned short length; + unsigned short code; + short runlen; +} tableentry; + +extern tableentry TIFFFaxWhiteCodes[]; +extern tableentry TIFFFaxBlackCodes[]; + +static short sp_data, sp_bit; + +static unsigned char +fetchByte (inbuf) + +unsigned char **inbuf; + +{ + unsigned char byte = **inbuf; + (*inbuf)++; + return (byte); +} + +static int +decode_white_run (inbuf) + +unsigned char **inbuf; + +{ + short state = sp_bit; + short action; + int runlen = 0; + + for (;;) + { + if (sp_bit == 0) + { + nextbyte: + sp_data = fetchByte (inbuf); + } + + action = TIFFFax1DAction[state][sp_data]; + state = TIFFFax1DNextState[state][sp_data]; + if (action == 0 ) + goto nextbyte; + if (action == 1 ) + return (-1 ); + if (action == 210 ) + return (-3 ); + sp_bit = state; + action = (TIFFFaxWhiteCodes[ action - 2 ].runlen) ; + runlen += action; + if (action < 64) + return (runlen); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-2.c b/gcc/testsuite/gcc.c-torture/compile/980506-2.c new file mode 100644 index 000000000..6f6fe1927 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980506-2.c @@ -0,0 +1,89 @@ +/* + * inspired by glibc-2.0.6/sysdeps/libm-ieee754/s_nextafterf.c + * + * gcc -O2 -S -DOP=+ gives faddp %st(1),%st + * gcc -O2 -S -DOP=* gives fmulp %st(1),%st + * gcc -O2 -S -DOP=- gives fsubrp %st(1),%st + * gcc -O2 -S -DOP=/ gives fdivrp %st(1),%st + */ + +#ifndef OP +#define OP * +#endif + +typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ; +typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ; + +typedef union +{ + float value; + u_int32_t word; +} ieee_float_shape_type; + +float __nextafterf(float x, float y) +{ + int32_t hx,hy,ix,iy; + + { + ieee_float_shape_type gf_u; + gf_u.value = x; + hx = gf_u.word; + } + { + ieee_float_shape_type gf_u; + gf_u.value = y; + hy = gf_u.word; + } + ix = hx&0x7fffffff; + iy = hy&0x7fffffff; + + if ( ix > 0x7f800000 || iy > 0x7f800000 ) + return x+y; + if (x == y) return x; + if (ix == 0) + { + { + ieee_float_shape_type sf_u; + sf_u.word = (hy&0x80000000) | 1; + x = sf_u.value; + } + y = x*x; + if (y == x) return y; else return x; + } + if (hx >= 0) + { + if (hx > hy) + hx -= 1; + else + hx += 1; + } + else + { + if (hy >= 0 || hx > hy) + hx -= 1; + else + hx += 1; + } + hy = hx & 0x7f800000; + if (hy >= 0x7f800000) + return x+x; + if (hy < 0x00800000) + { + y = x OP x; + if (y != x) + { + ieee_float_shape_type sf_u; + sf_u.word = hx; + y = sf_u.value; + return y; + } + } + { + ieee_float_shape_type sf_u; + sf_u.word = hx; + x = sf_u.value; + } + return x; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/980511-1.c b/gcc/testsuite/gcc.c-torture/compile/980511-1.c new file mode 100644 index 000000000..f1bac0c43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980511-1.c @@ -0,0 +1,20 @@ +typedef unsigned int __kernel_dev_t; +typedef __kernel_dev_t dev_t; +struct ustat { +}; +typedef unsigned int kdev_t; +static inline kdev_t to_kdev_t(int dev) +{ + int major, minor; + major = (dev >> 8); + minor = (dev & 0xff); + return ((( major ) << 22 ) | ( minor )) ; +} +struct super_block { +}; +struct super_block * get_super (kdev_t dev); +int sys_ustat(dev_t dev, struct ustat * ubuf) +{ + struct super_block *s; + s = get_super(to_kdev_t(dev)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980701-1.c b/gcc/testsuite/gcc.c-torture/compile/980701-1.c new file mode 100644 index 000000000..82dd16d6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980701-1.c @@ -0,0 +1,9 @@ + +short +func(void) +{ + unsigned char x, y; + + return y | x << 8; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980706-1.c b/gcc/testsuite/gcc.c-torture/compile/980706-1.c new file mode 100644 index 000000000..214f36d53 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980706-1.c @@ -0,0 +1,10 @@ +void g(long long); + +long long f(long long v1, long long v2, long long v3, long long v4) +{ + g(v1); + g(v2); + g(v3); + g(v4); + return v1 && v2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980726-1.c b/gcc/testsuite/gcc.c-torture/compile/980726-1.c new file mode 100644 index 000000000..3d4daa203 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980726-1.c @@ -0,0 +1,10 @@ +static __inline__ unsigned char BCD(unsigned char binval) +{ + if (binval > 99) return 0x99; + return (((binval/10) << 4) | (binval%10)); +} + +void int1a(unsigned char i) +{ + (*((unsigned char *)1)) = BCD(i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980729-1.c b/gcc/testsuite/gcc.c-torture/compile/980729-1.c new file mode 100644 index 000000000..973372b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980729-1.c @@ -0,0 +1,14 @@ +static int +regex_compile () +{ + int c, c1; + char str[6 + 1]; + c1 = 0; + for (;;) + { + do { } while (0) ; + if (c1 == 6 ) + break; + str[c1++] = c; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980816-1.c b/gcc/testsuite/gcc.c-torture/compile/980816-1.c new file mode 100644 index 000000000..a79100fab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980816-1.c @@ -0,0 +1,51 @@ +typedef __SIZE_TYPE__ size_t; +typedef void *XtPointer; + +typedef struct _WidgetRec *Widget; +typedef struct _WidgetClassRec *WidgetClass; + +extern WidgetClass commandWidgetClass; + +typedef void (*XtCallbackProc)( + Widget , + XtPointer , + XtPointer +); + +extern const char XtStrings[]; + + +typedef struct +{ + char *Name, + *Label; + XtCallbackProc Callback; + XtPointer ClientData; + Widget W; +} DialogButtonType, *DialogButtonTypePtr; + + +Widget AddButtons(Widget Parent, Widget Top, + DialogButtonTypePtr Buttons, size_t Count) +{ + int i; + + for (i = 0; i < Count; i++) + { + if (!Buttons[i].Label) + continue; + Buttons[i].W = XtVaCreateManagedWidget(Buttons[i].Name, + commandWidgetClass, + Parent, + ((char*)&XtStrings[429]) , Buttons[i].Label, + "fromHoriz" , i ? Buttons[i-1].W : ((void *)0) , + "fromVert" , Top, + "resizable" , 1 , + ((void *)0) ); + + XtAddCallback(((char*)&XtStrings[136]), + Buttons[i].Callback, Buttons[i].ClientData); + } + return(Buttons[Count-1].W); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980821-1.c b/gcc/testsuite/gcc.c-torture/compile/980821-1.c new file mode 100644 index 000000000..9eb1ac4ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980821-1.c @@ -0,0 +1,15 @@ +typedef int __int32_t; +int __kernel_rem_pio2(int prec) +{ + __int32_t i, jz; + double fw, fq[20]; + switch(prec) { + case 2: + fw = 0.0; + case 3: + for (i=jz;i>0;i--) { + fw = fq[i-1] +fq[i]; + fq[i-1] = fw; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980825-1.c b/gcc/testsuite/gcc.c-torture/compile/980825-1.c new file mode 100644 index 000000000..34e35bf83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980825-1.c @@ -0,0 +1,30 @@ +typedef enum { FALSE, TRUE } boolean; +enum _errorTypes { FATAL = 1, WARNING = 2, PERROR = 4 }; +typedef struct _optionValues { + struct _include { + boolean classNames; + boolean defines; + boolean enumerators; + } include; +} optionValues; +extern optionValues Option; +static void applyTagInclusionList( list ) + const char *const list; +{ + boolean mode = TRUE; + const char *p; + for (p = list ; *p != '\0' ; ++p) + switch (*p) + { + case '=': + clearTagList(); + mode = TRUE; + break; + case '+': mode = TRUE; break; + case '-': mode = FALSE; break; + case 'c': Option.include.classNames = mode; break; + case 'd': Option.include.defines = mode; break; + case 'e': Option.include.enumerators = mode; break; + default: error(FATAL, "-i: Invalid tag option '%c'", *p); break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-1.c b/gcc/testsuite/gcc.c-torture/compile/981001-1.c new file mode 100644 index 000000000..d7cf0dc64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-1.c @@ -0,0 +1,18 @@ +unsigned short code = 0x0000; +unsigned short low = 0x4000; +unsigned short high = 0xb000; + +int main (void) +{ + if ( + (high & 0x8000) != (low & 0x8000) + && ( low & 0x4000) == 0x4000 + && (high & 0x4000) == 0 + ) + { + code ^= 0x4000; + low |= 0x4000; + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-2.c b/gcc/testsuite/gcc.c-torture/compile/981001-2.c new file mode 100644 index 000000000..f635cbb60 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-2.c @@ -0,0 +1,14 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +#define weak_alias(func, aliasname) \ + extern __typeof (func) aliasname __attribute__ ((weak, alias (#func))); + +#define add3(d, m, c) ((d) + (m) + (c)) + +int +__add3(int d, int m, int c) +{ + return d + m + c; +} + +weak_alias (__add3, add3) diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-3.c b/gcc/testsuite/gcc.c-torture/compile/981001-3.c new file mode 100644 index 000000000..5f6458757 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-3.c @@ -0,0 +1,14 @@ +#define P(a, b) P1(a,b) +#define P1(a,b) a##b + +#define FLT_MIN_EXP (-125) +#define DBL_MIN_EXP (-1021) + +#define MIN_EXP P(FLT,_MIN_EXP) + +#define FLT FLT +int f1 = MIN_EXP; + +#undef FLT +#define FLT DBL +int f2 = MIN_EXP; diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-4.c b/gcc/testsuite/gcc.c-torture/compile/981001-4.c new file mode 100644 index 000000000..dd3df9cce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-4.c @@ -0,0 +1,14 @@ +#define P(a,b) P1(a,b) +#define P1(a,b) a##b + +#define ONCE(x, y) (x ?: (x = y())) +#define PREFIX + +extern int P(PREFIX, init) (void); + +int +fun(void) +{ + static int memo; + return ONCE(memo, P(PREFIX, init)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981006-1.c b/gcc/testsuite/gcc.c-torture/compile/981006-1.c new file mode 100644 index 000000000..d77c115f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981006-1.c @@ -0,0 +1,53 @@ +/* Test that tablejump insns are correctly handled. If the compiler + loses track of the jump targets, it will report that x and y can be + used uninitialized. + + This is broken in egcs 1998/10/06 for mips in pic mode. */ +/* { dg-do assemble } */ +/* For MIPS at least, pic is needed to trigger the problem. */ +/* { dg-options "-w -Wuninitialized -Werror -fpic" } */ +/* { dg-options "-w -Wuninitialized -Werror" { target { { rs6000-*-aix* powerpc*-*-aix* arm*-*-* fr30-*-* sh-*-hms h8300*-*-* cris-*-elf* mmix-*-* } || { ! fpic } } } } */ + +int foo (int a, int b) +{ + __label__ z; + int x; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ + int y; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ + static void *p; + + switch (a) { + case 2: + x = 4; + break; + case 4: + x = 6; + break; + case 8: case 10: case 13: case 11: case 17: case 19: + x = 7; + break; + default: + x = -1; + break; + } + switch (b) { + case 2: + y = 4; + break; + case 4: + y = 6; + break; + case 8: case 10: case 13: case 11: case 17: case 19: + y = 7; + break; + default: + y = -1; + break; + } + z: + p = &&z; + return x * y; +} +int main (int argc, char *argv[]) +{ + return 1 == foo (argc, argc + 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981007-1.c b/gcc/testsuite/gcc.c-torture/compile/981007-1.c new file mode 100644 index 000000000..d41400b78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981007-1.c @@ -0,0 +1,21 @@ +extern double fabs (double); +extern double sqrt (double); + +typedef struct complexm { + double re,im; +} complex; + +static complex +setCom (double r, double i) +{ + complex ct; + ct.re=fabs(r)<1E-300?0.0:r; + ct.im=fabs(i)<1E-300?0.0:i; + return ct; +} + +static complex +csqrt_crash (double x) +{ + return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981107-1.c b/gcc/testsuite/gcc.c-torture/compile/981107-1.c new file mode 100644 index 000000000..987ec180f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981107-1.c @@ -0,0 +1,9 @@ +unsigned long seed(void) +{ + unsigned long u; + + call(); + + u = 26107 * (unsigned long)&u; + return u; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.c b/gcc/testsuite/gcc.c-torture/compile/981223-1.c new file mode 100644 index 000000000..b62894807 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981223-1.c @@ -0,0 +1,17 @@ +/* The problem on IA-64 is that the assembler emits + + Warning: Additional NOP may be necessary to workaround Itanium + processor A/B step errata */ + +/* { dg-prune-output "Assembler messages" } */ +/* { dg-prune-output "Additional NOP may be necessary" } */ + + +__complex__ float +func (__complex__ float x) +{ + if (__real__ x == 0.0) + return 1.0; + else + return 0.0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990107-1.c b/gcc/testsuite/gcc.c-torture/compile/990107-1.c new file mode 100644 index 000000000..a123ce9cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990107-1.c @@ -0,0 +1,7 @@ +static int +java_double_finite (d) + double d; +{ + long long *ip = (long long *) &d; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990117-1.c b/gcc/testsuite/gcc.c-torture/compile/990117-1.c new file mode 100644 index 000000000..dda522059 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990117-1.c @@ -0,0 +1,13 @@ +static void +__bb_init_prg () +{ + const char *p; + + { + unsigned long l; + + (__extension__ (__builtin_constant_p (p) && __builtin_constant_p (l) + ? 5 : 2)); + } + +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990203-1.c b/gcc/testsuite/gcc.c-torture/compile/990203-1.c new file mode 100644 index 000000000..2c69a8fe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990203-1.c @@ -0,0 +1,7 @@ +int +f (f) + float f; +{ + long long *ip = (long long *) &f; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990517-1.c b/gcc/testsuite/gcc.c-torture/compile/990517-1.c new file mode 100644 index 000000000..c738d4be7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990517-1.c @@ -0,0 +1,30 @@ +/* Extracted from the sdm module in perl. */ +typedef struct { + char *dptr; + int dsize; +} datum; +extern long sdbm_hash (char *, int) ; +extern void sdbm__putpair (char *, datum, datum) ; +void +sdbm__splpage (char *pag, char *New, long int sbit) +{ + datum key; + datum val; + register int n; + register int off = 1024 ; + char cur[1024 ]; + register short *ino = (short *) cur; + (void) memcpy(cur, pag, 1024 ); + (void) ({ void *__s = ( pag ); __builtin_memset ( __s , '\0', 1024 ) ; __s; }); + (void) ({ void *__s = ( New ); __builtin_memset ( __s , '\0', 1024 ) ; __s; }); + n = ino[0]; + for (ino++; n > 0; ino += 2) { + key.dptr = cur + ino[0]; + key.dsize = off - ino[0]; + val.dptr = cur + ino[1]; + val.dsize = ino[0] - ino[1]; + (void) sdbm__putpair ((sdbm_hash(( key ).dptr, ( key ).dsize) & sbit) ? New : pag, key, val); + off = ino[1]; + n -= 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990519-1.c b/gcc/testsuite/gcc.c-torture/compile/990519-1.c new file mode 100644 index 000000000..9c1161782 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990519-1.c @@ -0,0 +1,10 @@ + typedef int gboolean; + + typedef struct{ + gboolean names : 1; + gboolean types : 1; + } ParamOptions; + + int p_param(ParamOptions* o){ + return o->types && o->names; + } diff --git a/gcc/testsuite/gcc.c-torture/compile/990523-1.c b/gcc/testsuite/gcc.c-torture/compile/990523-1.c new file mode 100644 index 000000000..5ab61f36c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990523-1.c @@ -0,0 +1,30 @@ +extern float decwin[512+32]; + +int synth_1to1(float *bandPtr,int channel,unsigned char *out,int *pnt) +{ + static const int step = 2; + short *samples = (short *) (out+*pnt); + + float *b0; + int clip = 0; + int bo1; + + { + register int j; + float *window = decwin + 16 - bo1; + for (j=15;j;j--,b0-=0x20,window-=0x10,samples+=step) + { + float sum; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + + if( ( sum ) > 32767.0) *( samples ) = 0x7fff; ( clip )++; ; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990527-1.c b/gcc/testsuite/gcc.c-torture/compile/990527-1.c new file mode 100644 index 000000000..474403030 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990527-1.c @@ -0,0 +1,37 @@ +typedef struct { + int dummy; + int width, height; +} XWindowAttributes; + +typedef struct { + short x, y; +} XPoint; + +extern unsigned int ya_random (void); +extern int XDrawPoints(XPoint*, int); + +static int iterations, offset; +static int xsym, ysym; + +static void +hurm (void) +{ + XWindowAttributes xgwa; + int xlim, ylim, x, y, i; + XPoint points [4]; + + + for (i = 0; i < iterations; i++) + { + int j = 0; + j++; + if (xsym) + { + points [j].x = xlim - x; + j++; + } + points [j].x = x; + j++; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990617-1.c b/gcc/testsuite/gcc.c-torture/compile/990617-1.c new file mode 100644 index 000000000..e9d3cf336 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990617-1.c @@ -0,0 +1,21 @@ +/* 0x70000000 is too large a constant to become a pointer on + xstormy16. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { xstormy16-*-* } { "*" } { "" } } */ + +int main() +{ + do { + long l; + long *p = &l; + + *p = 0x0000000070000000L; + p += 2; + { + unsigned int *addr = (unsigned int *)0x70000000; + printf("%d, %d\n", addr[1], addr[0]); + } + + } while (1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990625-1.c b/gcc/testsuite/gcc.c-torture/compile/990625-1.c new file mode 100644 index 000000000..97a2331c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990625-1.c @@ -0,0 +1,12 @@ +#define __USE_STRING_INLINES +#include <string.h> + +void test() +{ + char *p, *a; + const char *s; + + while ( (s = a) ) + p = strcpy(strcpy(p,"/"), s); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990625-2.c b/gcc/testsuite/gcc.c-torture/compile/990625-2.c new file mode 100644 index 000000000..92c33742b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990625-2.c @@ -0,0 +1,12 @@ +void +broken030599(int *n) +{ + int i, x; + for (i = 0; i < 32; i++) { + x=0; + x++; + if (i & 4) + x++; + x++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990801-1.c b/gcc/testsuite/gcc.c-torture/compile/990801-1.c new file mode 100644 index 000000000..d35ec87b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990801-1.c @@ -0,0 +1,26 @@ +extern int getch(); +extern int class(); + +int +token() +{ + int state = 1; + + while (1) { + int c=0; + c = getch(); + switch (state) { + case 1: break; + case 4: break; + case 5: break; + case 6: + { + switch (class(c)) { + default: break; + } + } break; + case 7: break; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990801-2.c b/gcc/testsuite/gcc.c-torture/compile/990801-2.c new file mode 100644 index 000000000..0a575ea17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990801-2.c @@ -0,0 +1,11 @@ +void f() +{ + extern char* p; + int ch; + while (!(ch = 0)) { + if ((ch == 0) || (ch == 2)) { + break; + } + *p = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990829-1.c b/gcc/testsuite/gcc.c-torture/compile/990829-1.c new file mode 100644 index 000000000..225282193 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990829-1.c @@ -0,0 +1,13 @@ +struct x +{ + int a:16; + int b:16; + int c; +}; + +bar() +{ + struct x y; + y.b = 1 < y.a; + foo(&y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990913-1.c b/gcc/testsuite/gcc.c-torture/compile/990913-1.c new file mode 100644 index 000000000..cad31a022 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990913-1.c @@ -0,0 +1,10 @@ + +int f() +{ + unsigned char hrs, min; + + min = ((min / 10) << 4) + min % 10; + hrs = ((hrs / 10) << 4) + hrs % 10; + + return hrs + min; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990928-1.c b/gcc/testsuite/gcc.c-torture/compile/990928-1.c new file mode 100644 index 000000000..5658e3605 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990928-1.c @@ -0,0 +1,10 @@ +/* Make sure that debug information can be generated + for inline functions containing incomplete type + declarations. */ +inline int foo (void) +{ + struct imcomplete1 * ptr1; + union incomplete2 * ptr2; + enum incomplete3 * ptr3; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991008-1.c b/gcc/testsuite/gcc.c-torture/compile/991008-1.c new file mode 100644 index 000000000..ba668fe25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991008-1.c @@ -0,0 +1,23 @@ +typedef struct { + int x; +} FILE; +extern void fputs (const char *, FILE *); + +int mView; +void foo (FILE * out, int aIndent) +{ + if (0 != mView) { + aIndent++; + aIndent--; + { + int __t = aIndent; + while (--__t >= 0) + fputs (" ", out); + } + + } { + int __t = aIndent; + while (--__t >= 0) + fputs (" ", out); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991026-1.c b/gcc/testsuite/gcc.c-torture/compile/991026-1.c new file mode 100644 index 000000000..191742112 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991026-1.c @@ -0,0 +1,13 @@ +void something_f(float); + +int foo(void) +{ + union + { + float f; + double d; + } u, *pu = &u; + + u.f = 1.0; + something_f(u.f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991026-2.c b/gcc/testsuite/gcc.c-torture/compile/991026-2.c new file mode 100644 index 000000000..bb358f411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991026-2.c @@ -0,0 +1,33 @@ +typedef int __pid_t; +extern __pid_t fork (void) ; +extern int printf (__const char *__restrict __format, ...) ; +extern char *strerror (int __errnum) ; +extern int errno; +extern int *__errno_location (void) __attribute__ ((__const__)); +extern void _exit (int __status) __attribute__ ((__noreturn__)); +extern void exit (int __status) __attribute__ ((__noreturn__)); +extern int close (int __fd) ; +extern int dup (int __fd) ; +extern int open (__const char *__file, int __oflag, ...) ; + + +char myname[]="foo"; + +detach() +{ + switch(fork()) { + case -1: + printf("%s: Error: fork - %s\n",myname, strerror((*__errno_location ()) )); + exit(255); + case 0: + + close(0); + close(1); + close(2); + dup(dup(open("/dev/null", 02 ))); + return; + default: + + _exit(0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991127-1.c b/gcc/testsuite/gcc.c-torture/compile/991127-1.c new file mode 100644 index 000000000..86098d883 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991127-1.c @@ -0,0 +1,12 @@ + +extern void foo (int *); + +static void bar (char *buf) +{ + int a; + foo (&a); + while (a > 0) { + *buf++ = '0'; + a--; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991202-1.c b/gcc/testsuite/gcc.c-torture/compile/991202-1.c new file mode 100644 index 000000000..cc4f478f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991202-1.c @@ -0,0 +1,18 @@ +extern float A[], B[]; +extern float MAXNUMF; +float chbevlf(float, float *, int); +float expf(float), i1f(float), logf(float), sqrtf(float); + +float k1f(float xx) +{ + float x, y; + + x = xx; + if( x <= 2.0 ) + { + y = x * x - 2.0; + y = logf( 0.5f * x ) * i1f(x) + chbevlf( y, A, 7 ) / x; + return( y ); + } + return( expf(-x) * chbevlf( (float)(8.0/x - 2.0), B, 10 ) / sqrtf(x) ); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991208-1.c b/gcc/testsuite/gcc.c-torture/compile/991208-1.c new file mode 100644 index 000000000..1bee1e84b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991208-1.c @@ -0,0 +1,4 @@ +void fn (char *ptr) +{ + void *p = ptr - 8 - 4; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-1.c b/gcc/testsuite/gcc.c-torture/compile/991213-1.c new file mode 100644 index 000000000..4803d1391 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991213-1.c @@ -0,0 +1,13 @@ +typedef __complex__ double double_complex; + + + +void +p (const double_complex *t, int n) +{ + int i; + double s = ({ typeof ( t[n/2] ) arg = ( t[n/2] ); (__imag__ arg); }) ; + for (i = 1; i < n/2; i++) + s += 2* ({ typeof ( t[i] ) arg = ( t[i] ); (__imag__ arg); }) ; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-2.c b/gcc/testsuite/gcc.c-torture/compile/991213-2.c new file mode 100644 index 000000000..98385d562 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991213-2.c @@ -0,0 +1,15 @@ +typedef long __kernel_time_t; +typedef __kernel_time_t time_t; +time2( + void (* const (funcp)(time_t)), + const long offset, int * const okayp) +{ + register int bits; + time_t t; + for (bits = 0, t = 1; t > 0; ++bits, t <<= 1) + ; + t = (t < 0) ? 0 : ((time_t) 1 << bits); + for ( ; ; ) { + (*funcp)((time_t)&t); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-3.c b/gcc/testsuite/gcc.c-torture/compile/991213-3.c new file mode 100644 index 000000000..ce8347f5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991213-3.c @@ -0,0 +1,2 @@ +int jump () { goto * (int (*) ()) 0xbabebec0; } + diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-1.c b/gcc/testsuite/gcc.c-torture/compile/991214-1.c new file mode 100644 index 000000000..2748a15af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991214-1.c @@ -0,0 +1,11 @@ +void foo(double bar[], double *zp, int n) +{ + int i, j; + + i = 0; + for(j = 0; j < n; j++) + { + i += j+1; + bar[i] *= (1.0 + *zp); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-2.c b/gcc/testsuite/gcc.c-torture/compile/991214-2.c new file mode 100644 index 000000000..3e18d215e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991214-2.c @@ -0,0 +1,28 @@ +#if defined(STACK_SIZE) && (STACK_SIZE < 65536) +# define HISTO_SIZE 9 +#else +# define HISTO_SIZE 36 +#endif + +extern int N; +extern int nrows; +extern int or_num_angles; + +typedef struct +{ + double value; + int count; +}Histo; + +Histo add_histo[10][2][HISTO_SIZE][HISTO_SIZE]; + +void cmd_connection_statistics( ) +{ + int i,j,k,m; + + for(i=0; i<nrows; i++){ + for(j=0; j< 2; j++) + for(k=0; k< or_num_angles; k++) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991229-1.c b/gcc/testsuite/gcc.c-torture/compile/991229-1.c new file mode 100644 index 000000000..d11fd91fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991229-1.c @@ -0,0 +1,23 @@ +static int parse (int, int); +static int parseStmt (int, int); + +ejEval() +{ + int state; + state = parse(8 , 0x1 ); +} +static int parse(int state, int flags) +{ + switch (state) { + case 8 : + case 18 : + case 6 : + case 2 : + state = parseStmt(state, flags); + break; + } +} +static int parseStmt(int state, int flags) +{ + parse (2, flags); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991229-2.c b/gcc/testsuite/gcc.c-torture/compile/991229-2.c new file mode 100644 index 000000000..0c562199f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991229-2.c @@ -0,0 +1,10 @@ +void foo (); + +void update (double* r) +{ + foo (); + { + register double y1; + y1 = r[ 4] - r[11]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991229-3.c b/gcc/testsuite/gcc.c-torture/compile/991229-3.c new file mode 100644 index 000000000..710e4c995 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991229-3.c @@ -0,0 +1,17 @@ +int m[8],b[8]; + +int main(){ + int i; + + for(;;){ + m[0] = rand(); + if(m[0] == 0){ + for(i=0;i<8;i++){ + m[i] = b[i]; + } + break; + } + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/acc1.c b/gcc/testsuite/gcc.c-torture/compile/acc1.c new file mode 100644 index 000000000..5b5bcd42d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/acc1.c @@ -0,0 +1,21 @@ +/* { dg-options "-ffast-math" } */ + +/* Fast maths allows tail recursion to be turned into iteration. */ + +double +foo (int n, double f) +{ + if (n == 0) + return f; + else + return f + foo (n - 1, f); +} + +double +bar (int n, double f) +{ + if (n == 0) + return f; + else + return f * bar (n - 1, f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/asmgoto-1.c b/gcc/testsuite/gcc.c-torture/compile/asmgoto-1.c new file mode 100644 index 000000000..cc34610ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/asmgoto-1.c @@ -0,0 +1,30 @@ +void fn (void); + +void +foo (void *x, unsigned long y) +{ + asm goto ("": : : : lab); +lab: + fn (); +} + +static void +bar (unsigned long x) +{ + foo (0, x); +} + +static void +baz (unsigned long x) +{ + if (x > 8192) + bar (x); + else + ({ __here: (unsigned long) &&__here; }); +} + +void +test (void) +{ + baz (16384); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c b/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c new file mode 100644 index 000000000..5d3a882c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c @@ -0,0 +1,14 @@ +/* PR middle-end/31095, expand_builtin_memmove_args forgot to take into + account that tree folding of builtins can add an extra NOP_EXPR. */ + +struct timeval +{ + int tv_sec; + int tv_usec; +}; +void +capture_next_packet (void) +{ + struct timeval past, now, then; + __builtin_bcopy (&then, &past, sizeof (then)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c b/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c new file mode 100644 index 000000000..8b18c8af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c @@ -0,0 +1,6 @@ +int main (int argc, char *argv[]) +{ + static int a[] = { __builtin_constant_p (argc) ? 1 : 0 }; + return a[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c b/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c new file mode 100644 index 000000000..dd32ca806 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c @@ -0,0 +1,6 @@ +void bar (const char *); +void foo (void) +{ + bar ("foo"); + __builtin_unreachable (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/calls.c b/gcc/testsuite/gcc.c-torture/compile/calls.c new file mode 100644 index 000000000..1582c0e92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/calls.c @@ -0,0 +1,22 @@ +typedef void *(*T)(void); +f1 () +{ + ((T) 0)(); +} +f2 () +{ + ((T) 1000)(); +} +f3 () +{ + ((T) 10000000)(); +} +f4 (r) +{ + ((T) r)(); +} +f5 () +{ + int (*r)() = f3; + ((T) r)(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c new file mode 100644 index 000000000..9e1b659c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c @@ -0,0 +1,15 @@ +f (long long d) +{ + int i = 0; + if (d == 1) + i = 1; + return i; +} + +g (long long d) +{ + int i = 0; + if (d <= 0) + i = 1; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/combine-hang.c b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c new file mode 100644 index 000000000..7cc57afe6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c @@ -0,0 +1,26 @@ +typedef union +{ + double value; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; +} ieee_double_shape_type; + +double f (int iy) +{ + double z, t; + ieee_double_shape_type u, v; + + if (iy == 1) + return 0; + + u.parts.msw = iy; + u.parts.lsw = 0; + z = u.value; + v.parts.msw = iy; + v.parts.lsw = 0; + t = v.value; + return 1.0+z+t+t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compile.exp b/gcc/testsuite/gcc.c-torture/compile/compile.exp new file mode 100644 index 000000000..01c5644ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compile.exp @@ -0,0 +1,34 @@ +# Expect driver script for GCC Regression Tests +# Copyright (C) 1993, 1995, 1997, 2003, 2007 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# These tests come from Torbjorn Granlund's (tege@cygnus.com) +# C torture test suite, and other contributors. + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +set saved-dg-do-what-default ${dg-do-what-default} +set dg-do-what-default "assemble" +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-w" +set dg-do-what-default ${saved-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-1.c b/gcc/testsuite/gcc.c-torture/compile/complex-1.c new file mode 100644 index 000000000..6ba9f0469 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-1.c @@ -0,0 +1,12 @@ +extern void u (int, int); +extern void v (float, float); + +void f (__complex__ int x) +{ + u (0, x); +} + +void g (__complex__ float x) +{ + v (0, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-2.c b/gcc/testsuite/gcc.c-torture/compile/complex-2.c new file mode 100644 index 000000000..4462eee45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-2.c @@ -0,0 +1,16 @@ +/* PR 22103 */ + +_Complex float f(void); +void *a; + +_Complex float g(void) +{ + _Complex float x = f(); + __imag__ x = 1.0; + if (__imag__ x != 1.0) + { + a = &x; + } + return x; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-3.c b/gcc/testsuite/gcc.c-torture/compile/complex-3.c new file mode 100644 index 000000000..f12a8f9da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-3.c @@ -0,0 +1,17 @@ +/* PR 22116 */ + +void g(_Complex float); +_Complex float f(int data, _Complex float x, _Complex float y) +{ + _Complex float i, t; + if (data) + { + i = x + __imag__ y; + g(i); + } + else + i = 5; + t = x + __imag__ y; + g(t); + return t * i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-4.c b/gcc/testsuite/gcc.c-torture/compile/complex-4.c new file mode 100644 index 000000000..cf1002903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-4.c @@ -0,0 +1,9 @@ +/* This used to ICE because gimplify_modify_expr_complex_part was not + updated for the GIMPLE_MODIFY_EXPR changes in that calling + tree_to_gimple_tuple was needed. */ + +void f(void) +{ + double _Complex Res; + __real__ Res = __imag__ Res = 0.0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-5.c b/gcc/testsuite/gcc.c-torture/compile/complex-5.c new file mode 100644 index 000000000..59ddf68be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-5.c @@ -0,0 +1,9 @@ +int foo(__complex__ int z0, __complex__ int z1) +{ + return z0 != 0 || z1 != 0; +} + +int foo1(__complex__ int z0, __complex__ int z1) +{ + return z0 == 0 && z1 == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-6.c b/gcc/testsuite/gcc.c-torture/compile/complex-6.c new file mode 100644 index 000000000..eb89040ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-6.c @@ -0,0 +1,17 @@ +/* PR tree-opt/35737 */ + +long buf[10]; + +int foo() +{ + __complex__ int i = 0; + + if (__builtin_setjmp(buf)) + { + i = 1; + bar(); + } + + return i == 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c new file mode 100644 index 000000000..968bb450a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c @@ -0,0 +1,9 @@ +/* ICE incrementing compound literal: bug 28418 from Volker Reichelt + <reichelt@gcc.gnu.org>. */ + +struct A { int i; }; + +void foo() +{ + ((struct A) { 0 }).i += 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c new file mode 100644 index 000000000..7e2f30400 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c @@ -0,0 +1,8 @@ +/* PR C/30265, invalid gimple was produced because we did not mark + the compound literal's decl early enough. */ + +int f(float *); +int g(float x) +{ + return f(&(float){x}) + f(&x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c new file mode 100644 index 000000000..bcd413c9c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c @@ -0,0 +1,8 @@ +/* PR C/30265, invalid gimple was produced because we did not mark + the compound literal's decl early enough. */ + +int f(_Complex float *); +int g(_Complex float x) +{ + return f(&(_Complex float){x+1}) + f(&x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/const-high-part.c b/gcc/testsuite/gcc.c-torture/compile/const-high-part.c new file mode 100644 index 000000000..95e205970 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/const-high-part.c @@ -0,0 +1,19 @@ +/* { dg-require-effective-target int32plus } */ +/* { dg-require-effective-target size32plus } */ + +char *buf; +int buflen; + +inline int +sub (int length) +{ + if (length <= buflen) + buf[length] = '\0'; + return 0; +} + +int +sub2 (void) +{ + return sub (0x7fffffff); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/cpp-1.c b/gcc/testsuite/gcc.c-torture/compile/cpp-1.c new file mode 100644 index 000000000..09d49bc61 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cpp-1.c @@ -0,0 +1,8 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ + +#define foo/**/1 +#if foo != 1 +# error "foo not properly defined" +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/cpp-2.c b/gcc/testsuite/gcc.c-torture/compile/cpp-2.c new file mode 100644 index 000000000..ae9425f09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cpp-2.c @@ -0,0 +1,5 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ + +#pragma /* the token after #pragma is optional. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c b/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c new file mode 100644 index 000000000..3911f87bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c @@ -0,0 +1,11 @@ +extern void dynreplace_trampoline(void); +extern void dynreplace_trampoline_endlabel(void); +int dynreplace_add_trampoline(void) +{ + unsigned long trampoline_code[(((unsigned long) +(&(dynreplace_trampoline_endlabel)) +-(unsigned long) (&dynreplace_trampoline))) +]; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/dll.c b/gcc/testsuite/gcc.c-torture/compile/dll.c new file mode 100644 index 000000000..7f7bfcee5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/dll.c @@ -0,0 +1,23 @@ +/* { dg-require-dll "" } */ + +__declspec (dllimport) int foo; +extern int (* import) (void) __attribute__((dllimport)); +int func2 (void) __attribute__((dllexport)); + +__declspec(dllexport) int +func1 (int a) +{ + return a + foo; +} + +static int +internal (void) +{ + return 77; +} + +int +func2 (void) +{ + return import (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c b/gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c new file mode 100644 index 000000000..dbd428259 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c @@ -0,0 +1,12 @@ +/* PR target/14201 */ +/* Excercise float -> integer in memory patterns. */ +/* { dg-add-options ieee } */ + +void f1 (float v, int *p) { *p = v; } +void f2 (float v, unsigned int*p) { *p = v; } +void f3 (float v, long long *p) { *p = v; } +void f4 (float v, unsigned long long *p) { *p = v; } +void f5 (double v, int *p) { *p = v; } +void f6 (double v, unsigned int *p) { *p = v; } +void f7 (double v, long long *p) { *p = v; } +void f8 (double v, unsigned long long *p) { *p = v; } diff --git a/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c new file mode 100644 index 000000000..79687c9c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c @@ -0,0 +1,19 @@ +extern int (*gp)(const char*); + +int +g (const char* d) +{ + printf ("g"); + return 0; +} + +f () +{ + int errcnt=0; + + if (gp != g) + { + printf ("f"); + errcnt++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/goto-1.c b/gcc/testsuite/gcc.c-torture/compile/goto-1.c new file mode 100644 index 000000000..caeed3aa0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/goto-1.c @@ -0,0 +1,16 @@ +f () +{ + do + { + if (0) + { + L1:; + } + else + goto L2; + L2:; + } + while (0); + + goto L1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c new file mode 100644 index 000000000..a0adc78cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c @@ -0,0 +1,99 @@ +/* Verify that ifcvt doesn't crash under a number of interesting conditions. */ + +void f1(int p) +{ + if (p) + __builtin_trap(); +} + +void f2(int p) +{ + if (p) + __builtin_trap(); + else + bar(); +} + +void f3(int p) +{ + if (p) + bar(); + else + __builtin_trap(); +} + +void f4(int p, int q) +{ + if (p) + { + bar(); + if (q) + bar(); + } + else + __builtin_trap(); +} + +void f5(int p) +{ + if (p) + __builtin_trap(); + else + abort(); +} + +void f6(int p) +{ + if (p) + abort(); + else + __builtin_trap(); +} + +void f7(int p) +{ + if (p) + __builtin_trap(); + else + __builtin_trap(); +} + +void f8(int p) +{ + if (p) + __builtin_trap(); + else + { + bar(); + __builtin_trap(); + } +} + +void f9(int p) +{ + if (p) + { + bar(); + __builtin_trap(); + } + else + __builtin_trap(); +} + +void f10(int p) +{ + if (p) + __builtin_trap(); + while (1) + bar(); +} + +void f11(int p) +{ + if (p) + __builtin_trap(); + else + bar(); + while (1) + baz(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c new file mode 100644 index 000000000..bb7bb5726 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c @@ -0,0 +1,10 @@ +void foo(int p, int q) +{ + if (p) + { + if (q) + __builtin_trap (); + } + else + bar(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c new file mode 100644 index 000000000..52278e145 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c @@ -0,0 +1,4 @@ +/* Check that the conditional_trap pattern handles floating-point + comparisons correctly. */ +void f1 (float x, float y) { if (x == y) __builtin_trap (); } +void f2 (double x, double y) { if (x == y) __builtin_trap (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/init-1.c b/gcc/testsuite/gcc.c-torture/compile/init-1.c new file mode 100644 index 000000000..38db9ad87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-1.c @@ -0,0 +1,19 @@ +typedef struct +{ + char *key; + char *value; +} T1; + +typedef struct +{ + long type; + char *value; +} T3; + +T1 a[] = +{ + { + "", + ((char *)&((T3) {1, (char *) 1})) + } +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-2.c b/gcc/testsuite/gcc.c-torture/compile/init-2.c new file mode 100644 index 000000000..63a7f5849 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-2.c @@ -0,0 +1,4 @@ +struct +{ + int e1, e2; +} v = { e2: 0 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-3.c b/gcc/testsuite/gcc.c-torture/compile/init-3.c new file mode 100644 index 000000000..be3d9b496 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-3.c @@ -0,0 +1,11 @@ +struct empty { }; +struct something { + int spacer; + struct empty foo; + int bar; +}; + +struct something X = { + foo: { }, + bar: 1, +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/inline-1.c b/gcc/testsuite/gcc.c-torture/compile/inline-1.c new file mode 100644 index 000000000..23af7cb2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/inline-1.c @@ -0,0 +1,21 @@ +typedef __builtin_va_list va_list; + +extern void foo (va_list); + +static void +build_message_string (const char *msg, ...) +{ + va_list ap; + + __builtin_va_start (ap, msg); + foo (ap); + __builtin_va_end (ap); +} + +void +file_name_as_prefix (f) + const char *f; +{ + build_message_string ("%s: ", f); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-1.c b/gcc/testsuite/gcc.c-torture/compile/labels-1.c new file mode 100644 index 000000000..fae6ab8f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-1.c @@ -0,0 +1,13 @@ +#ifndef NO_LABEL_VALUES +f () +{ + void *x = &&L2; + if (&&L3 - &&L1 > 1) + abort(); + L1: return 1; + L2: abort (); + L3:; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-2.c b/gcc/testsuite/gcc.c-torture/compile/labels-2.c new file mode 100644 index 000000000..cf4f116e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-2.c @@ -0,0 +1,10 @@ +struct bp { void *v, *b, *e; }; +f () +{ + struct bp x = { &&L2 }; + if (&&L3 - &&L1 > 1) + abort (); +L1:return 1; +L2:abort (); +L3:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-3.c b/gcc/testsuite/gcc.c-torture/compile/labels-3.c new file mode 100644 index 000000000..14eb9522f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-3.c @@ -0,0 +1,18 @@ +/* This test does not compile on mips-irix6 using the native assembler, + though it does work with gas. See PR6200. Since we cannot (???) + distinguish which assembler is being used, always pass -S for + irix. */ +/* { dg-options "-w -S" { target mips*-*-irix* } } */ + +/* Verify that we can narrow the storage associated with label diffs. */ + +int foo (int a) +{ + static const short ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; + void *p = &&l1 + ar[a]; + goto *p; + l1: + return 1; + l2: + return 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/libcall-1.c b/gcc/testsuite/gcc.c-torture/compile/libcall-1.c new file mode 100644 index 000000000..c1b1cfc61 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/libcall-1.c @@ -0,0 +1,14 @@ +/* Failed on ARM because rtx_varies_p didn't like the REG_EQUAL notes + generated for libcalls. + http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01518.html */ +static const char digs[] = "0123456789ABCDEF"; +int __attribute__((pure)) bar(); + +int foo (int i) +{ + int len; + if (i) + return 0; + len = bar(); + return digs[len]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c b/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c new file mode 100644 index 000000000..545dfe4dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c @@ -0,0 +1,22 @@ +#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9; +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +void q9_func(void) +{ +#if __INT_MAX__ >= 100000 + LIM5(char t) +#else + LIM4(char t) +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c b/gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c new file mode 100644 index 000000000..08e8195bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c @@ -0,0 +1,21 @@ +#define LIM1(x) x##0: x##1: x##2: x##3: x##4: x##5: x##6: x##7: x##8: x##9: +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +void q19_func (long i) +{ + switch (i) { + LIM5 (case 1) + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c b/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c new file mode 100644 index 000000000..ee8558006 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c @@ -0,0 +1,16 @@ +/* { dg-xfail-if "" { alpha*-dec-osf5* } { "-g" } { "" } } */ +#define PTR1 (* (* (* (* (* (* (* (* (* (* +#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 +#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 +#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 +#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 +#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 + +#define RBR1 ) ) ) ) ) ) ) ) ) ) +#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 +#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 +#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 +#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 +#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 + +int PTR4 q4_var RBR4 = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c b/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c new file mode 100644 index 000000000..975cafc83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c @@ -0,0 +1,22 @@ +#define LIM1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9, +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +enum q21_enum +{ +#if __INT_MAX__ >= 100000 + LIM5 (e) +#else + LIM4 (e) +#endif +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c b/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c new file mode 100644 index 000000000..2c6dce04a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c @@ -0,0 +1,15 @@ +#define LBR1 ( ( ( ( ( ( ( ( ( ( +#define LBR2 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 +#define LBR3 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 +#define LBR4 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 +#define LBR5 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 +#define LBR6 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 + +#define RBR1 ) ) ) ) ) ) ) ) ) ) +#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 +#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 +#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 +#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 +#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 + +int q5_var = LBR4 0 RBR4; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-externalid.c b/gcc/testsuite/gcc.c-torture/compile/limits-externalid.c new file mode 100644 index 000000000..1b316c791 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-externalid.c @@ -0,0 +1,15 @@ +#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9; +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +LIM5(char t) diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c b/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c new file mode 100644 index 000000000..c484becb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c @@ -0,0 +1,56 @@ +/* Inspired by the test case for PR middle-end/52640. */ + +typedef struct +{ + char *value; +} REFERENCE; + +/* Add a few "extern int Xxxxxx ();" declarations. */ +#undef DEF +#undef LIM1 +#undef LIM2 +#undef LIM3 +#undef LIM4 +#undef LIM5 +#undef LIM6 +#define DEF(x) extern int x () +#define LIM1(x) DEF(x##0); DEF(x##1); DEF(x##2); DEF(x##3); DEF(x##4); \ + DEF(x##5); DEF(x##6); DEF(x##7); DEF(x##8); DEF(x##9); +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +LIM5 (X); + +/* Add references to them, or GCC will simply ignore the extern decls. */ +#undef DEF +#undef LIM1 +#undef LIM2 +#undef LIM3 +#undef LIM4 +#undef LIM5 +#undef LIM6 +#define DEF(x) (char *) x +#define LIM1(x) DEF(x##0), DEF(x##1), DEF(x##2), DEF(x##3), DEF(x##4), \ + DEF(x##5), DEF(x##6), DEF(x##7), DEF(x##8), DEF(x##9), +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +REFERENCE references[] = { + LIM5 (X) + 0 +}; + diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c new file mode 100644 index 000000000..126a2b8e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c @@ -0,0 +1,23 @@ +/* { dg-timeout-factor 4.0 } */ +/* { dg-require-effective-target run_expensive_tests } */ + +#define PAR1 int, int, int, int, int, int, int, int, int, int +#define PAR2 PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1 +#define PAR3 PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2 +#define PAR4 PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3 +#define PAR5 PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4 +#define PAR6 PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5 + +extern void func (PAR4); + +#define ARG1 0,1,2,3,4,5,6,7,8,9 +#define ARG2 ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1 +#define ARG3 ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2 +#define ARG4 ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3 +#define ARG5 ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4 +#define ARG5HALF ARG5, ARG5, ARG5, ARG5, ARG5 + +void caller(void) +{ + func (ARG4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c b/gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c new file mode 100644 index 000000000..65e60b39e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c @@ -0,0 +1,19 @@ +/* { dg-skip-if "too complex for avr and picochip" { picochip-*-* avr-*-* } { "*" } { "" } } */ +/* { dg-timeout-factor 4.0 } */ +#define LIM1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9, +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +void func1 (LIM5(int p) int t) +{ +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c b/gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c new file mode 100644 index 000000000..1f346aadf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c @@ -0,0 +1,11 @@ +#define LIM1 0123456789 +#define LIM2 LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1 +#define LIM3 LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2 +#define LIM4 LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3 +#define LIM5 LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4 +#define LIM6 LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5 + +#define V(x) v##LIM5##x + +int V(a); +int V(b); diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c b/gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c new file mode 100644 index 000000000..cbd095ee0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c @@ -0,0 +1,11 @@ +#define LIM1 0123456789 +#define LIM2 LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1 +#define LIM3 LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2 +#define LIM4 LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3 +#define LIM5 LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4 +#define LIM6 LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5 + +#define V(x) v##LIM6##x + +static int V(a); +static int V(b); diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c b/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c new file mode 100644 index 000000000..435155566 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c @@ -0,0 +1,9 @@ +/* { dg-xfail-if "" { alpha*-dec-osf5* } { "-g" } { "" } } */ +#define PTR1 * * * * * * * * * * +#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 +#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 +#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 +#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 +#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 + +int PTR4 q3_var = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c new file mode 100644 index 000000000..41fa2f140 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c @@ -0,0 +1,12 @@ +/* { dg-skip-if "Array too big" { avr-*-* picochip-*-* m32c-*-* pdp11-*-* } { "*" } { "" } } */ + +#define STR2 "012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789" +#define STR3 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 +#define STR4 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 +#define STR5 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 +#define STR6 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 +#define STR7 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 +#define STR8 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 + +char vlv[] = STR6; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-structmem.c b/gcc/testsuite/gcc.c-torture/compile/limits-structmem.c new file mode 100644 index 000000000..2f2265a5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-structmem.c @@ -0,0 +1,18 @@ +#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9; +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +struct q20_struct +{ + LIM4 (char m) +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-structnest.c b/gcc/testsuite/gcc.c-torture/compile/limits-structnest.c new file mode 100644 index 000000000..62448fb51 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-structnest.c @@ -0,0 +1,23 @@ +#define LIM1(x) x##0 {x##1 {x##2 {x##3 {x##4 {x##5 {x##6 {x##7 {x##8 {x##9 { +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +#define RBR1 } x; } x; } x; } x; } x; } x; } x; } x; } x; } x; +#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 +#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 +#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 +#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 + +LIM4(struct s) + int x; +RBR4 diff --git a/gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c b/gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c new file mode 100644 index 000000000..88667a461 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c @@ -0,0 +1,20 @@ +/* This testcase triggered an attempt to reload a byte value into an + address register. */ +extern volatile unsigned char x[]; + +#define DECLARE(I) orig##I, inc##I +#define READ(I) orig##I = x[I] +#define INC(I) inc##I = orig##I + 1 +#define WRITE1(I) x[I] = orig##I +#define WRITE2(I) x[I] = inc##I + +#define REPEAT(X) X(0), X(1), X(2), X(3), X(4), X(5), X(6), X(7), X(8) + +void foo (void) +{ + unsigned char REPEAT (DECLARE); + REPEAT (READ); + REPEAT (INC); + REPEAT (WRITE1); + REPEAT (WRITE2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mangle-1.c b/gcc/testsuite/gcc.c-torture/compile/mangle-1.c new file mode 100644 index 000000000..7abc934e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mangle-1.c @@ -0,0 +1,9 @@ +int foo(void) +{ + static int x asm ("x") = 3; + return x++; +} + +int X2 asm ("x.0") = 4; +int X3 asm ("_x.0") = 5; + diff --git a/gcc/testsuite/gcc.c-torture/compile/memcpy-1.c b/gcc/testsuite/gcc.c-torture/compile/memcpy-1.c new file mode 100644 index 000000000..4a4e75096 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/memcpy-1.c @@ -0,0 +1,9 @@ +static const char OggFLAC__MAPPING_VERSION_MAJOR = 1; +void f(void) +{ + char synthetic_first_packet_body[10]; + char *b = &synthetic_first_packet_body[4]; + __builtin_memcpy (b, &OggFLAC__MAPPING_VERSION_MAJOR, (1u)); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/memcpy-2.c b/gcc/testsuite/gcc.c-torture/compile/memcpy-2.c new file mode 100644 index 000000000..4645ced59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/memcpy-2.c @@ -0,0 +1,10 @@ +static const char OggFLAC__MAPPING_VERSION_MAJOR = 1; +void f(void) +{ + char synthetic_first_packet_body[10]; + char *b = synthetic_first_packet_body; + b+=4u; + __builtin_memcpy (b, &OggFLAC__MAPPING_VERSION_MAJOR, (1u)); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c new file mode 100644 index 000000000..8a40ba1c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned int cp0count asm ("$c0r1"); + +int __attribute__ ((nomips16)) +main (int argc, char *argv[]) +{ + unsigned int d; + + d = cp0count + 3; + printf ("%d\n", d); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c new file mode 100644 index 000000000..94df41d65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned int c3r1 asm ("$c3r1"); + +extern unsigned int b, c; + +void __attribute__ ((nomips16)) +foo () +{ + unsigned int a, d; + + c3r1 = a; + b = c3r1; + + c3r1 = c; + d = c3r1; + printf ("%d\n", d); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c new file mode 100644 index 000000000..cb4bd4d3e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned int c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); + +extern unsigned int b, c; + +void __attribute__ ((nomips16)) +foo () +{ + unsigned int a, d; + + c3r1 = a; + b = c3r1; + + c3r2 = c; + d = c3r1; + printf ("%d\n", d); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c new file mode 100644 index 000000000..263fc5cac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned long c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); + +extern unsigned long b, c; + +void __attribute__ ((nomips16)) +foo () +{ + unsigned long a, d; + + c3r1 = a; + b = c3r1; + + c3r2 = c; + d = c3r1; + printf ("%d\n", d); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/nested-1.c b/gcc/testsuite/gcc.c-torture/compile/nested-1.c new file mode 100644 index 000000000..135538a85 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/nested-1.c @@ -0,0 +1,21 @@ +/* { dg-require-effective-target trampolines } */ + +typedef __SIZE_TYPE__ size_t; +extern int printf (const char *, ...); +extern void *memset (void *, int, size_t); + +int bar (int (*)(), int, void *); + +int +main(int argc, char **argv) +{ + struct s { int a; char b[argc]; }; + int nested (struct s x) { return x.a + sizeof(x); } + struct s t; + memset (&t, 0, sizeof(t)); + t.a = 123; + printf("%d\n", bar (nested, argc, &t)); + return 0; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/nested-2.c b/gcc/testsuite/gcc.c-torture/compile/nested-2.c new file mode 100644 index 000000000..6e61b323b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/nested-2.c @@ -0,0 +1,16 @@ +/* PR 21105 */ + +void +CheckFile () +{ + char tagname[10]; + char *a = tagname; + + int validate () + { + return (a == tagname + 4); + } + + if (a == tagname) + validate (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/packed-1.c b/gcc/testsuite/gcc.c-torture/compile/packed-1.c new file mode 100644 index 000000000..709fc3cb1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/packed-1.c @@ -0,0 +1,14 @@ +struct s +{ + int e; +} x; + +struct rbuf +{ + struct s *p __attribute__ ((packed)); +} *b; + +f () +{ + b->p = &x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pc44485.c b/gcc/testsuite/gcc.c-torture/compile/pc44485.c new file mode 100644 index 000000000..fc959257d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pc44485.c @@ -0,0 +1,46 @@ +static int +foo (int si1, int si2) +{ + return si1 > 0 && si2 > 0 && si1 > -si2 || si1 < 0 && si2 < 0 + && si1 < -si2 ? : si1 + si2; +} + +struct S0 +{ + unsigned short f1; +}; +int g_4; +struct S0 g_54 = { + 3428 +}; + +int +func_21 (int * p_22, int * const int32p_24, unsigned p_25, + const int * p_26); + +void int324 (unsigned p_15, int * p_16, int * p_17, int * p_18) +{ + if (foo (g_4, func_21 (p_18, &g_4, 0, 0))) + { + for (g_54.f1; g_54.f1; g_54.f1 += 1) + { + } + } +} + +int +func_21 (int * p_22, int * const int32p_24, unsigned p_25, + const int * p_26) +{ + for (0; 1; p_25 += 1) + lbl_29:if (p_25) + goto lbl_28; +lbl_28:for (p_25 = 0; p_25 < 9; p_25 += 1) + if (p_25) + goto lbl_29; + unsigned short l_53; + for (0; l_53; l_53 = foo) + { + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr12517.c b/gcc/testsuite/gcc.c-torture/compile/pr12517.c new file mode 100644 index 000000000..af82db8f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr12517.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/12517 */ + +int f(void); +void g(int); +void h(int a, int b, int c) +{ + int i = f(); + + if (b && (i & 4)) + g(i & 8 ? 0 : 1); + if (a) { + do { + if (i & 8) + g(0); + if (i & 4) + g(i ? 0 : 1); + } while (--c); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr12578.c b/gcc/testsuite/gcc.c-torture/compile/pr12578.c new file mode 100644 index 000000000..69afffe00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr12578.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/12517 */ + +void trivial_regexp_p(int *s, int len) +{ + while (--len) { + switch (*s++) { + case '\\': + switch (*s++) { + case '|': + ; + } + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr12899.c b/gcc/testsuite/gcc.c-torture/compile/pr12899.c new file mode 100644 index 000000000..6bd4724fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr12899.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/12899 */ + +void +bb_getopt_ulflags (char *s) +{ + for (;;) + if (s[1]) + do + s++; + while (*s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c b/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c new file mode 100644 index 000000000..c2930f95d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c @@ -0,0 +1,10 @@ +void *g, *c; +int a, b; + +int f() +{ + if ((0 == a) != (b || g == c)) + return 1; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr13889.c b/gcc/testsuite/gcc.c-torture/compile/pr13889.c new file mode 100644 index 000000000..d14bc9ac5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr13889.c @@ -0,0 +1,7 @@ +/* PR target/13889 */ +struct { long long a; } *p; +void initNetFlowFunct(void) { + unsigned int b = (unsigned int)-1; + p->a = b; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr14692.c b/gcc/testsuite/gcc.c-torture/compile/pr14692.c new file mode 100644 index 000000000..3f36b3ccb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr14692.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/14692 */ + +void assert_failed (void); +void eidecpos_1 (unsigned char *pos, long n) +{ + int i; + for (i = 0; i < n; i++) + { + const unsigned char *dc_ptr1 = pos; + pos--; + if (dc_ptr1 - pos == 1) + assert_failed (); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr14730.c b/gcc/testsuite/gcc.c-torture/compile/pr14730.c new file mode 100644 index 000000000..6f08ab465 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr14730.c @@ -0,0 +1,16 @@ +/* PR middle-end/14730 */ + +int t (char i) +{ + switch (i) + { + case 1: + case 7: + case 10: + case 14: + case 9: + case 256: + return 0; + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr15245.c b/gcc/testsuite/gcc.c-torture/compile/pr15245.c new file mode 100644 index 000000000..d7d9051a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr15245.c @@ -0,0 +1,21 @@ +/* Testcase from <marcus@jet.franken.de> + PR optimization/15245 + This used to ICE as convert was used + in tree-ssa-phiopt which created non gimple + code. */ + +char *f(char *x, int flag) +{ + char *ret = (char*)0; + + + if( x > (char*)1 ) { + if(x) + return (char*)0; + } else { + if( flag & 1 ) + ret = (char*)1; + flag |= 2; + } + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16461.c b/gcc/testsuite/gcc.c-torture/compile/pr16461.c new file mode 100644 index 000000000..b48eee205 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16461.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/16461 */ + +int DVDinput_read(int); +int DVDReadBlocksPath(int offset, int block_count) { + int ret = 0, ret2 = 0; + for (;;) { + if (offset) + ret = DVDinput_read(block_count); + else + ret2 = DVDinput_read(block_count); + break; + } + return ret + ret2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c b/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c new file mode 100644 index 000000000..4ed4ab730 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c @@ -0,0 +1,15 @@ +/* ICE with flexible arrays in non-lvalue structures. Bug 16566 + (comment #3). */ + +struct S; + +struct C { + int i; + struct S *tab[]; +}; + +struct S { struct C c; }; + +void foo (struct S *x) { + foo(((void)1, x->c).tab[0]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c b/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c new file mode 100644 index 000000000..2f7a10668 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c @@ -0,0 +1,14 @@ +/* ICE with flexible arrays in non-lvalue structures. Bug 16566 + (comment #5). */ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ + +struct A +{ + int i; + int x[]; +}; + +int foo(struct A a) +{ + return (a,a).x[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c b/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c new file mode 100644 index 000000000..954aa361d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c @@ -0,0 +1,12 @@ +/* ICE with flexible arrays in non-lvalue structures. Bug 16566 + (testcase from duplicate bug 16575). */ + +struct S; +struct C { + int i; + struct S *tab[]; +}; +struct S { struct C c; }; +void foo (struct S *x) { + ((void)1, x->c).tab[0] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16808.c b/gcc/testsuite/gcc.c-torture/compile/pr16808.c new file mode 100644 index 000000000..28527de5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16808.c @@ -0,0 +1,38 @@ +/* We used to ICE as we did not mark a Vop for rename as + we changed a function call to a normal modify statement + while folding exp(0.0); */ + +double exp(double); +void f0(void); +void f(double); +typedef struct Parser { + int x; + char *s; +} Parser; +static double pop(Parser *p) { + if (p->s[0] <= 0) { + f0(); + return 0; + } + --p->x; + return 0; +} +static void evalFactor(Parser *p) { + while (p->x) + f(exp(pop(p))); +} +static void evalTerm(Parser *p) { + while (p->s[0]) + evalFactor(p); +} +static void evalExpression(Parser *p) { + evalTerm(p); + while (p->s[0]) + evalTerm(p); +} +void evalPrimary(Parser *p) { + if (p->s) + return; + evalExpression(p); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17119.c b/gcc/testsuite/gcc.c-torture/compile/pr17119.c new file mode 100644 index 000000000..28d6ccbe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17119.c @@ -0,0 +1,19 @@ +void +_mesa_DrawPixels (int width, int height, unsigned format, + unsigned type, const void * pixels) +{ + switch (format) + { + case 0x1900: + func1 (); + break; + case 0x1907: + case 0x80E0: + case 0x1908: + case 0x80E1: + case 0x8000: + func2 (); + break; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17273.c b/gcc/testsuite/gcc.c-torture/compile/pr17273.c new file mode 100644 index 000000000..42d318ef6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17273.c @@ -0,0 +1,22 @@ +struct A { int i; }; +struct B { struct A a; }; + +void f(struct A*, struct A*); +#define bool _Bool + +void bar(bool b) +{ + struct B * D1601; + struct A D1576; + struct A * D1593; + struct B * D1592; + struct B D1575; + + D1575 = (struct B){}; + + if (b) D1592 = &D1575; else D1592 = &D1575; + + D1593 = &D1592->a; // <-- we are prograting &D1575 into here. + D1576 = (struct A){}; + f (D1593, &D1576); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17397.c b/gcc/testsuite/gcc.c-torture/compile/pr17397.c new file mode 100644 index 000000000..b857472f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17397.c @@ -0,0 +1,12 @@ +/* ICE due to invalid GIMPLE created during strlen simplification. */ + +extern unsigned long strlen (__const char *__s); +extern void bar (); +extern int cols; + +void foo (void) +{ + char s[cols + 2]; + if (strlen (s) > 0) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17407.c b/gcc/testsuite/gcc.c-torture/compile/pr17407.c new file mode 100644 index 000000000..a06ab1758 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17407.c @@ -0,0 +1,15 @@ +typedef struct libxml_xpathCallback { + void *ns_uri; +} libxml_xpathCallback; + +typedef libxml_xpathCallback libxml_xpathCallbackArray[]; + +libxml_xpathCallbackArray *libxml_xpathCallbacks; + +void foo1(void); + +void +foo (void) +{ + if ((*libxml_xpathCallbacks)[3].ns_uri != ((void *)0)) foo1(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17408.c b/gcc/testsuite/gcc.c-torture/compile/pr17408.c new file mode 100644 index 000000000..4819673f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17408.c @@ -0,0 +1,5 @@ +/* PRs 17408 and 17409, with different options. */ +extern int t; +extern int t = 0; +void f(){t =0;} +void g(){h(&t);} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17529.c b/gcc/testsuite/gcc.c-torture/compile/pr17529.c new file mode 100644 index 000000000..63a96a1c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17529.c @@ -0,0 +1,14 @@ + +static inline void +bar (const int * const x) +{ + __asm__ __volatile__ (""::"m" (*x)); +} + +static const int y[1]; + +void +foo (void) +{ + bar (y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17558.c b/gcc/testsuite/gcc.c-torture/compile/pr17558.c new file mode 100644 index 000000000..bc6655285 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17558.c @@ -0,0 +1,10 @@ +struct xobject { + char type; +}; +extern struct xobject *t1_Xform ( struct xobject *obj); +struct xobject * +t1_Xform(struct xobject *obj) +{ + register struct font *F = (struct font *) obj; + return((struct xobject*)F); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17656.c b/gcc/testsuite/gcc.c-torture/compile/pr17656.c new file mode 100644 index 000000000..0acb71f0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17656.c @@ -0,0 +1,18 @@ +int sprintf (char *s, const char *format, ...); + +int foo(int i, int j) +{ + char *buf, *str; + + if (i) + str = ""; + else if (j) + str = ""; + else + return 1; + + /* We were propagating &""[0] here and not calling fold_stmt with a + proper statement pointer. */ + sprintf(buf, str); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17906.c b/gcc/testsuite/gcc.c-torture/compile/pr17906.c new file mode 100644 index 000000000..2b18a6aab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17906.c @@ -0,0 +1,7 @@ +struct usc_bigstack_t {}; + +void +usc_recressive_func(int cnt, int max, struct usc_bigstack_t bstack) +{ + usc_recressive_func(cnt+1, max, bstack); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17913.c b/gcc/testsuite/gcc.c-torture/compile/pr17913.c new file mode 100644 index 000000000..30654a395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17913.c @@ -0,0 +1,7 @@ +/* Test for computed jump into cond_expr: bug 17913. */ +void f (void) +{ + void *p = &&a; + 1 ? 1 : ({ a : 1; }); + goto *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18291.c b/gcc/testsuite/gcc.c-torture/compile/pr18291.c new file mode 100644 index 000000000..7d983696f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18291.c @@ -0,0 +1,12 @@ +int baz(int k2) +{ + int i, j, *p, k = 1, k1 = 0; + if (k2) + p = &j; + else + p = &i; + if (k1) + *p = 0 , p = &k; + *p = 1; + return k; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18299-1.c b/gcc/testsuite/gcc.c-torture/compile/pr18299-1.c new file mode 100644 index 000000000..7dc115701 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18299-1.c @@ -0,0 +1,12 @@ +/* We used to ICE in gimple-lower because we + would produce __t (VAR_DECL) as a statement in the + instruction stream which is not valid. */ + +static inline int f(int i) +{ + const int __t = (__t); +} +int g(void) +{ + return f(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18712.c b/gcc/testsuite/gcc.c-torture/compile/pr18712.c new file mode 100644 index 000000000..7d53aaae8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18712.c @@ -0,0 +1,17 @@ +void *eintr_source (void *arg) +{ + int ts = 0; + + if (arg) + foo (); + + while (1) + { + if (arg) + foo (); + + foo1 (&ts); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18903.c b/gcc/testsuite/gcc.c-torture/compile/pr18903.c new file mode 100644 index 000000000..3c1235112 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18903.c @@ -0,0 +1,17 @@ +/* We were ICEing in bsi_after_labels because + we had a BB which did not have a lablel. + PR middle-end/18903 */ + +#ifndef NO_LABEL_VALUES +void g (int s, int f) +{ + &&ff; + s = f; + ff: + goto end; + f = s; + end:; +} +#else +int g; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19080.c b/gcc/testsuite/gcc.c-torture/compile/pr19080.c new file mode 100644 index 000000000..b5686b80b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19080.c @@ -0,0 +1,115 @@ +typedef union { int ioport; volatile char *maddr; } bus_space_handle_t; +struct scb { unsigned short *hscb; }; +struct ahd_softc +{ + int tags[2]; + bus_space_handle_t bshs[2]; + int dst_mode; + int src_mode; + int flags; +}; +void outb(int, int); + +int foo_inb(struct ahd_softc*); +int foo_int_int (int, int); +int ahd_inb(struct ahd_softc*); +int ahd_scb_active_in_fifo (void); + +void ahd_flush_qoutfifo (struct ahd_softc *ahd, struct scb *scb) +{ + int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1; + int bb, p; + + if (ahd->src_mode == 1) + { int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1;} + foo_int_int (ahd->src_mode, ahd->dst_mode); + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + while ((ahd_inb (ahd) & 0x01) != 0) + { + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + if (ahd_scb_active_in_fifo () == 0) + continue; + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + bb = (*(scb->hscb)); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + bb = (*(scb->hscb)); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + if (ahd->src_mode == 2 && ahd->dst_mode == dst) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + ahd->flags |= 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19121.c b/gcc/testsuite/gcc.c-torture/compile/pr19121.c new file mode 100644 index 000000000..b8f4c21f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19121.c @@ -0,0 +1,23 @@ +typedef struct interpreter { + char Itokenbuf[256]; +} PerlInterpreter; +static inline void S_missingterm(char *s) +{ + char tmpbuf[3] = ""; + char q; + if (!s) + s = tmpbuf; + q = strchr(s,'"') ? '\'' : '"'; +} +void S_scan_heredoc(PerlInterpreter *my_perl, char *s, int i) +{ + char term; + term = *my_perl->Itokenbuf; + if (i) + { + *s = term; + S_missingterm(my_perl->Itokenbuf); + } + else + S_missingterm(my_perl->Itokenbuf); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19357.c b/gcc/testsuite/gcc.c-torture/compile/pr19357.c new file mode 100644 index 000000000..2dc26d786 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19357.c @@ -0,0 +1,8 @@ +/* This generated an ICE for an ia64-linux target. */ +struct f { + float f[8]; +}; + +long double ftest(struct f arg1, long double arg2) { + return arg2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19736.c b/gcc/testsuite/gcc.c-torture/compile/pr19736.c new file mode 100644 index 000000000..0b618b126 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19736.c @@ -0,0 +1,21 @@ +/* We used to ICE because we had forgot to update the immediate_uses + information after foldding the last strcpy in Reduce PHI. + This was PR tree-opt/19763. */ + +extern char *strcpy (char *, const char *); +void sdbout_one_type (char *p) +{ + int i, t = 1; + char *q; + for (i = 0; i < 2; i++) + { + strcpy (p, "1"); + p += sizeof ("1"); + } + if (t) + q = "2"; + else + q = "3"; + strcpy (p, q); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19853.c b/gcc/testsuite/gcc.c-torture/compile/pr19853.c new file mode 100644 index 000000000..f7fdf49bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19853.c @@ -0,0 +1,19 @@ +struct test { int *x; } global_test; +int global_int; + +int flag; + +void test (char *dummy) +{ + static const struct test const_test = { &global_int }; + struct test local_test; + + int i; + for (i = 0; i < 1; i++) + *dummy = 0; + if (flag) + __builtin_memset (dummy, 0, 16); + + local_test = const_test; + global_test = local_test; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20203.c b/gcc/testsuite/gcc.c-torture/compile/pr20203.c new file mode 100644 index 000000000..1fb2a045d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20203.c @@ -0,0 +1,16 @@ +void *memset (void *, int, unsigned long); + +typedef struct bfd_section +{ + unsigned long size; + unsigned char *contents; +} asection; + +int +_bfd_mips_elf_finish_dynamic_sections (asection *s) +{ + long long dummy_offset; + dummy_offset = s->size - 16; + memset (s->contents + dummy_offset, 0, 16); + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20412.c b/gcc/testsuite/gcc.c-torture/compile/pr20412.c new file mode 100644 index 000000000..a165a921a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20412.c @@ -0,0 +1,20 @@ +int +foo(void) +{ + int a,b,g; + int i,len; + int stop; + + len = 10; + stop = 0; + for (i=0; i<len; i++) + { + a = bar1() ? 0 : 1; + b = bar2() ? 0 : 1; + g = bar3() ? 0 : 1; + + if (stop = ((a+b) % 2 != g)) break; + } + + return stop; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20539-1.c b/gcc/testsuite/gcc.c-torture/compile/pr20539-1.c new file mode 100644 index 000000000..f67f06b88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20539-1.c @@ -0,0 +1,10 @@ +char l7_en; +long long l6_data_Z_0th; +int t; +void f() +{ + if (((char )(l6_data_Z_0th>>1 & 1U)) & ((l6_data_Z_0th & 1U) + | !(((char )(l6_data_Z_0th>>35 & 15U))==14U))) + t = 0ULL; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20583.c b/gcc/testsuite/gcc.c-torture/compile/pr20583.c new file mode 100644 index 000000000..6c5f891d3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20583.c @@ -0,0 +1,30 @@ +/* PR target/20583 + On m68k-none-elf, CSE used to generate + + (set (reg:HI ...) + (const:HI (truncate:HI (minus:SI (label_ref ...) + (label_ref ...))))) + + which output functions do not know how to handle. Make sure that + such a constant will be rejected. */ + +void bar (unsigned int); + +void +foo (void) +{ + char buf[1] = { 3 }; + const char *p = buf; + const char **q = &p; + unsigned int ch; + switch (**q) + { + case 1: ch = 5; break; + case 2: ch = 4; break; + case 3: ch = 3; break; + case 4: ch = 2; break; + case 5: ch = 1; break; + default: ch = 0; break; + } + bar (ch); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20928.c b/gcc/testsuite/gcc.c-torture/compile/pr20928.c new file mode 100644 index 000000000..ea8be9e87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20928.c @@ -0,0 +1,10 @@ +extern struct bar_t bar; +void *a; +void +foo (void) +{ + void **p = a; + do { + *p++ = ((unsigned char *) &bar + ((unsigned long int) 1L << 31)); + } while (p); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21021.c b/gcc/testsuite/gcc.c-torture/compile/pr21021.c new file mode 100644 index 000000000..b74821630 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21021.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/21021 + + The front end produces a comparison of mismatched types, namely an + integer and a pointer, causing VRP to compute TYPE_MAX_VALUE for a + pointer, which we cannot. */ + +extern void *bar (void); + +int +foo (unsigned int *p, unsigned int *q) +{ + const void *r = bar (); + + if (r >= (const void *) *p + && r < (const void *) *q) + return 1; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21030.c b/gcc/testsuite/gcc.c-torture/compile/pr21030.c new file mode 100644 index 000000000..b7590c0ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21030.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/21030 + VRP used to create invalid ranges where VR->MIN is greater than + VR->MAX. */ + +void +foo (int unit) +{ + int i; + + for (i = 0; unit; i++, unit--) + { + if (i >= 0) + { + int j = i; + while (j) + j--; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21293.c b/gcc/testsuite/gcc.c-torture/compile/pr21293.c new file mode 100644 index 000000000..54184b3e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21293.c @@ -0,0 +1,12 @@ +/* Testcase from Dale Johannesen <dalej@gcc.gnu.org>. */ +struct { +double x[1]; +} g; +void k( double *, double*); +void h(int Tmp8) +{ + int i; + for(i = 1;i <= Tmp8;i++) + k(&g.x[ + -1],&g.x[ Tmp8 + -1]); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21356.c b/gcc/testsuite/gcc.c-torture/compile/pr21356.c new file mode 100644 index 000000000..b072b5165 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21356.c @@ -0,0 +1,13 @@ +int a; +void* p; + +void foo (void) +{ + switch (a) + { + a0: case 0: p = &&a1; + a1: case 1: p = &&a2; + a2: default: p = &&a1; + } + goto *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21380.c b/gcc/testsuite/gcc.c-torture/compile/pr21380.c new file mode 100644 index 000000000..55ac08e78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21380.c @@ -0,0 +1,42 @@ +void bar (void); + +void +foo (int *diff) +{ + double deltay = 0.0; + int Stangent = 0; + int mindiff; + int Sflipped = 0; + int i; + int Sturn, Snofit; + + Sturn = 1; + if (Sturn) + Stangent = 1; + if (Sturn) + { + Sflipped = 0; + Snofit = 1; + while (Snofit) + { + Snofit = 0; + mindiff = 0; + for (i = 0; i < 4; i++) + mindiff = diff[i]; + while (!Snofit && (mindiff < 0.0)) + { + deltay = (Stangent ? deltay : 0.0); + if (deltay < 0.0) + Snofit = 1; + for (i = 0; i < 4; i++) + { + } + } + if (Snofit) + if (Sflipped) + break; + } + if (Snofit) + bar (); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21532.c b/gcc/testsuite/gcc.c-torture/compile/pr21532.c new file mode 100644 index 000000000..1b8bc2248 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21532.c @@ -0,0 +1,14 @@ + + +int +bar (unsigned char key) +{ + unsigned char buf[sizeof (unsigned long)+2]; + unsigned char b; + unsigned char *buf_ = buf + 1; + + for (b = 8; b != 0; b--) + buf_[b] = key >> b; + + return foo (b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21562.c b/gcc/testsuite/gcc.c-torture/compile/pr21562.c new file mode 100644 index 000000000..9b4932f8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21562.c @@ -0,0 +1,25 @@ +/* { dg-options "-fno-inline" } */ +struct foo { int a, b, c; }; +void abort(void); +void exit(int); + +void +brother (int a, int b, int c) +{ + if (a) + abort (); +} + +void +sister (struct foo f, int b, int c) +{ + brother ((f.b == b), b, c); +} + +int +main () +{ + struct foo f = { 7, 8, 9 }; + sister (f, 1, 2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21638.c b/gcc/testsuite/gcc.c-torture/compile/pr21638.c new file mode 100644 index 000000000..36fd0104a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21638.c @@ -0,0 +1,21 @@ +typedef struct hashhdr { + int bitmaps[32]; +} HASHHDR; + +static void +swap_header_copy(HASHHDR *srcp, HASHHDR *destp) +{ + int i; + for (i = 0; i < 32; i++) + ((char *)&(destp->bitmaps[i]))[0] = ((char *)&(srcp->bitmaps[i]))[1]; +} + +int +flush_meta(HASHHDR *whdrp1) +{ + HASHHDR *whdrp; + HASHHDR whdr; + whdrp = &whdr; + swap_header_copy(whdrp1, whdrp); + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21728.c b/gcc/testsuite/gcc.c-torture/compile/pr21728.c new file mode 100644 index 000000000..991cb3886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21728.c @@ -0,0 +1,10 @@ +int main (void) +{ + __label__ l1; + void __attribute__((used)) q(void) + { + goto l1; + } + + l1:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21761.c b/gcc/testsuite/gcc.c-torture/compile/pr21761.c new file mode 100644 index 000000000..b9ca5c919 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21761.c @@ -0,0 +1,9 @@ +void f1() +{ + long bit=0, exponent; + exponent = -exponent; + for (bit = 1; exponent; bit <<= 1) + if (exponent & bit) + exponent ^= bit; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21839.c b/gcc/testsuite/gcc.c-torture/compile/pr21839.c new file mode 100644 index 000000000..c02085c2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21839.c @@ -0,0 +1,12 @@ + typedef struct { } spinlock_t; +typedef struct { + unsigned sequence; + spinlock_t lock; +} seqlock_t; +void ext3_new_inode(seqlock_t *rsv_seqlock) +{ + *rsv_seqlock = (seqlock_t) { 0, (spinlock_t) { } }; + +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21840.c b/gcc/testsuite/gcc.c-torture/compile/pr21840.c new file mode 100644 index 000000000..bec3d6bf5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21840.c @@ -0,0 +1,11 @@ +void fn_show_state(void); +typedef void (*fn_handler_fn)(void); +static fn_handler_fn fn_handler[1]; + +void k_spec(unsigned char value) +{ + void *func = fn_handler[value]; + if (func == fn_show_state ) + return; + fn_handler[value](); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c b/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c new file mode 100644 index 000000000..1dd0adcff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c @@ -0,0 +1,11 @@ +typedef unsigned short W; +typedef const W *P; + +extern void g(P); + +void +f () +{ + const P s = (const W []){ 'R' }; + g (s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22269.c b/gcc/testsuite/gcc.c-torture/compile/pr22269.c new file mode 100644 index 000000000..bfcf20926 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22269.c @@ -0,0 +1,16 @@ +/* We used to ICE in tree-ssa-reassoc because we did look at the correct operand to + see if it was a SSA_NAME. */ +int printf(const char*, ...); +int main(int argv, char*argc) { + + int d1; + int d2; + int s1, s2; + int b; + ((d1)&=(int)0x0000ffffL, (d1)|=((int)(short)(0x344))<<16); + ((d1)&=(int)0xffff0000UL, (d1)|=(int)(unsigned short)(0x4567)); + ((d2)&=(int)0x0000ffffL, (d2)|=((int)(short)(0))<<16); + ((d2)&=(int)0xffff0000UL, (d2)|=(int)(unsigned short)(0x3b9a)); + printf(" dividend >>: %ld\n", d1); + printf(" divisor >>: %ld\n", d2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22379.c b/gcc/testsuite/gcc.c-torture/compile/pr22379.c new file mode 100644 index 000000000..fae84a0af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22379.c @@ -0,0 +1,23 @@ +void __add_entropy_words(void); +void __wake_up(void); +void SHATransform(void); +static inline __attribute__((always_inline)) void add_entropy_words(void){} +void extract_entropy(void); +static inline __attribute__((always_inline)) void xfer_secondary_pool(void) +{ +extract_entropy(); +add_entropy_words(); +} +void extract_entropy(void) +{ +xfer_secondary_pool(); +__wake_up(); +} +void init_std_data(void) +{ +add_entropy_words(); +} +void rand_initialize(void) +{ +init_std_data(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22398.c b/gcc/testsuite/gcc.c-torture/compile/pr22398.c new file mode 100644 index 000000000..448de5712 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22398.c @@ -0,0 +1,21 @@ +#if ULONG_MAX != 4294967295u && ULONG_MAX != 18446744073709551615ull +int main(void) { exit (0); } +#else +#if ULONG_MAX != 18446744073709551615ull +#define NUM 0xf0000000 +#else +#define NUM 0xf000000000000000 +#endif + + +int func1(void *rw) +{ + return (rw && (((unsigned long) rw) >= NUM) ); +} + +void func2(void *rw) +{ + while(rw && (((unsigned long) rw) >= NUM) ) {} +} + +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22422.c b/gcc/testsuite/gcc.c-torture/compile/pr22422.c new file mode 100644 index 000000000..bc176f969 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22422.c @@ -0,0 +1,30 @@ +/* We should not crash trying to figure out the points-to sets for the below. We used to because we + ended up adding pointers to the points-to set of the ANYTHING variable. */ +struct D +{ + int n; + int c [8]; +}; + +struct A +{ + int i; + char *p; +}; + +struct B +{ + struct A *a; + struct D *d; +}; + +int dtInsert1 (struct B *b) +{ + struct A a = { 0, 0 }; + struct D *d; + b->a = &a; + d = b->d; + &d->c [d->n]; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22531.c b/gcc/testsuite/gcc.c-torture/compile/pr22531.c new file mode 100644 index 000000000..70e2df79f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22531.c @@ -0,0 +1,7 @@ +typedef struct dw_cfi_oprnd_struct { + unsigned long reg; +} dw_cfa_location; +void def_cfa_1 (void) { + dw_cfa_location loc; + loc.reg = loc.reg; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22589-1.c b/gcc/testsuite/gcc.c-torture/compile/pr22589-1.c new file mode 100644 index 000000000..d9cc0cfb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22589-1.c @@ -0,0 +1,4 @@ +int bar (char *foo) +{ + return (long long) ((int) foo + 0) < 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c b/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c new file mode 100644 index 000000000..356c06335 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c @@ -0,0 +1,8 @@ +void foo (volatile long long *x) +{ + while (*x) + { + *x = 0; + *((volatile char *) 0) = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23237.c b/gcc/testsuite/gcc.c-torture/compile/pr23237.c new file mode 100644 index 000000000..f3f917d0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23237.c @@ -0,0 +1,16 @@ +/* Don't assemble, as this section syntax may not be valid on all platforms + (e.g., Darwin). */ +/* { dg-do compile } */ + +/* { dg-require-effective-target named_sections } */ + +static __attribute__ ((__section__ (".init.data"))) char *message; +static __attribute__ ((__section__ (".init.data"))) int (*actions[])(void) = {}; +void unpack_to_rootfs(void) +{ + while (!message) + { + if(!actions[0]) + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23435.c b/gcc/testsuite/gcc.c-torture/compile/pr23435.c new file mode 100644 index 000000000..fb41af1e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23435.c @@ -0,0 +1,11 @@ +/* PR target/23435. + + On m68k-none-elf, this used to cause an unrecognized insn because + zero_extendsidi2 accepted operands that are both memory even though + such a pattern did not exist. */ + +void +foo (unsigned long *a, unsigned long long *p) +{ + *p = *a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23445.c b/gcc/testsuite/gcc.c-torture/compile/pr23445.c new file mode 100644 index 000000000..3ddf9b702 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23445.c @@ -0,0 +1,10 @@ + struct buffer_head { + char *b_data; + }; + void asfs_deletebnode( struct buffer_head *bhsec) { + if (bhsec == 0) { + void *bnc2 = (void *) bhsec->b_data; + if (bnc2) return; + if (bhsec) __brelse(bhsec); + } + } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23476.c b/gcc/testsuite/gcc.c-torture/compile/pr23476.c new file mode 100644 index 000000000..9cccde6e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23476.c @@ -0,0 +1,14 @@ +int h(int); +int t; +static inline int f(const int i) +{ + int tt = i; + _Bool a = i < t; + if (a) + return h(t); + return 9; +} +int g(void) +{ + return f(0x7FFFFFFF); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23929.c b/gcc/testsuite/gcc.c-torture/compile/pr23929.c new file mode 100644 index 000000000..210bb585e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23929.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/23929 */ + +extern void bar (char *); + +void +foo (int n, char *z) +{ + char b[2048]; + int x, y; + + bar (b); + for (y = 0; y < 60; y++) + if (n == 600) + for (x = 0; x < 320;) + { + *z++ = b[x]; + x += 1; + *z++ = b[x]; + x += 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23944.c b/gcc/testsuite/gcc.c-torture/compile/pr23944.c new file mode 100644 index 000000000..45bed7e5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23944.c @@ -0,0 +1,4 @@ +float f(float src[][4]) +{ + return *(src[3]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23946.c b/gcc/testsuite/gcc.c-torture/compile/pr23946.c new file mode 100644 index 000000000..ecaa5b163 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23946.c @@ -0,0 +1,72 @@ + +extern int foo (void); + +int +avi_parse_comments (int fd, char *buf, int space_left) +{ + int len = 0, readlen = 0, k; + char *data, *c, *d; + + if (fd <= 0 || !buf || space_left <= 0) + return -1; + + memset (buf, 0, space_left); + + readlen = foo (); + if (!(data = malloc (readlen * sizeof (char) + 1))) + return -1; + + c = data; + space_left--; + + while (len < space_left) + { + if (!c || *c == '\0') + break; + else if (*c == 'I') + { + d = c + 4; + + k = 0; + while (d[k] != '\r' && d[k] != '\n' && d[k] != '\0') + ++k; + if (k >= space_left) + return len; + + + memcpy (buf + len, c, 4); + len += 4; + + + long2str (buf + len, k + 1); + len += 4; + + + memcpy (buf + len, d, k); + + *(buf + len + k + 1) = '\0'; + + + if ((k + 1) & 1) + { + k++; + *(buf + len + k + 1) = '\0'; + } + len += k + 1; + + + while (*c != '\n' && *c != '\0') + ++c; + if (*c != '\0') + ++c; + else + break; + + } + } + free (data); + + return len; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23960.c b/gcc/testsuite/gcc.c-torture/compile/pr23960.c new file mode 100644 index 000000000..5ca0562af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23960.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/23960 + fold-const.c used to construct a comparison node with one pointer + operand and one non-pointer operand. */ + +void abort (void) __attribute__ ((noreturn)); + +void +foo (char *d, unsigned long int n) +{ + if (d + n > d) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24227.c b/gcc/testsuite/gcc.c-torture/compile/pr24227.c new file mode 100644 index 000000000..a4bb44ad4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24227.c @@ -0,0 +1,6 @@ +int Fdisplay_buffer (int buffer) +{ + if (((struct buffer *) ((unsigned int) buffer)) == + (0,(struct buffer *) ((unsigned int) ((buffer) & 1)))) + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24883.c b/gcc/testsuite/gcc.c-torture/compile/pr24883.c new file mode 100644 index 000000000..b2ced75ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24883.c @@ -0,0 +1,21 @@ +typedef struct _rec_stl rec_stl; +struct _rec_stl { + unsigned char **strs; +}; +orec_str_list(int count) { + rec_stl *stl; + int i, j; + int li, lj; + unsigned char ci, cj; + for (i = 0; i < count; i++) { + for (j = i + 1; j < count; j++) { + cj = lj > 2 ? stl->strs[j][0] : (long)stl->strs[j] & 0xff; + if ((count >= 16 && cj < ci) || (cj == ci && lj > li)) { + stl->strs[j] = stl->strs[i]; + ci ^= cj; + cj ^= ci; + ci ^= cj; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24930.c b/gcc/testsuite/gcc.c-torture/compile/pr24930.c new file mode 100644 index 000000000..d52bb5c50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24930.c @@ -0,0 +1,17 @@ +/* PR 24930 */ +extern int foo(int u) __attribute__((noinline)); +int foo(int u) {return 0;} +int +main(int argc, char** argv) +{ + const char *buf = argv[1]; + + unsigned int data = (((unsigned int) buf[0]) << 8) + (unsigned int) buf[1]; + if (data & 0x8000) { + data &= 0x7fff ; + data ^= 0x7fff ; + data += 1 ; + data *= -1 ; + } + return foo((int)data); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25224.c b/gcc/testsuite/gcc.c-torture/compile/pr25224.c new file mode 100644 index 000000000..0ccf0cdf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25224.c @@ -0,0 +1,20 @@ +/* { dg-options "-funswitch-loops" } */ +static float rgam; +extern void *jmp(void *); + +void drotmg(float d1) { +void *labels[] = { &&L170, &&L180, 0 }; + + for(;;) { + goto *jmp(labels); + if (d1 <= rgam) + goto L170; + +L170: + if (d1 <= rgam) + goto L170; + } + +L180: + goto L170; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25310.c b/gcc/testsuite/gcc.c-torture/compile/pr25310.c new file mode 100644 index 000000000..71081d821 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25310.c @@ -0,0 +1,22 @@ + +/* Prevent spurious test failures on 16-bit targets. */ +#if __INT_MAX__ >= 2147483647L + +extern int f (char *, int); + +void test (void) +{ + char buffer[65536]; + char *bufptr; + char *bufend; + int bytes; + + bufptr = buffer; + bufend = buffer + sizeof(buffer) - 1; + + while ((bytes = f (bufptr, bufend - bufptr)) > 0) + bufptr += bytes; +} + +#endif + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25311.c b/gcc/testsuite/gcc.c-torture/compile/pr25311.c new file mode 100644 index 000000000..26c5bc37b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25311.c @@ -0,0 +1,47 @@ + +struct w +{ + int top; + int left; + int height; + int width; + struct w *next; + struct w *parent; + struct w *child; +}; + +extern struct w *Qnil; + +void +set_size (struct w *w, int new_size, int nodelete, int set_height) +{ + int old_size = set_height? w->height : w->width; + + if (nodelete || w->parent == Qnil) + { + int last_pos, last_old_pos, pos, old_pos, first; + int div_val = old_size << 1; + struct w *c; + + last_pos = first = set_height? w->top : w->left; + last_old_pos = 0; + + for (c = w->child; c != Qnil; c = c->next) + { + if (set_height) + old_pos = last_old_pos + c->height; + else + old_pos = last_old_pos + c->width; + + pos = (((old_pos * new_size) << 1) + old_size) / div_val; + set_size (c, pos + first - last_pos, 1, set_height); + last_pos = pos + first; + last_old_pos = old_pos; + } + + if (!nodelete) + for (c = w->child; c != Qnil; c = c->next) + use (c); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25483.c b/gcc/testsuite/gcc.c-torture/compile/pr25483.c new file mode 100644 index 000000000..99151fda0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25483.c @@ -0,0 +1,15 @@ +/* { dg-options "-fmove-loop-invariants" } */ + +static int mdct_win[8]; +int x; + +int +decode_init (double d) +{ + int j; + for (j = 4; j; j--) + { + d *= 0.5; + mdct_win[j] = (d * 3); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25513.c b/gcc/testsuite/gcc.c-torture/compile/pr25513.c new file mode 100644 index 000000000..d2aa591fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25513.c @@ -0,0 +1,9 @@ +int f(void) +{ + static _Complex double t; + int i, j; + for(i = 0;i<2;i++) + for(j = 0;j<2;j++) + t = .5 * 1.0; + return t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25514.c b/gcc/testsuite/gcc.c-torture/compile/pr25514.c new file mode 100644 index 000000000..0bf5aa907 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25514.c @@ -0,0 +1,24 @@ +struct node { + struct node *next; + int value; +}; + +struct node *current_node, global_list; + +void +bar (void) +{ + struct node *node, *next; + + node = current_node; + next = node->next; + if (node != &global_list) + current_node = next; + else + { + node = global_list.next; + global_list.value = node->value; + global_list.next = node->next; + } + foo (node); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25860.c b/gcc/testsuite/gcc.c-torture/compile/pr25860.c new file mode 100644 index 000000000..033b567d8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25860.c @@ -0,0 +1,20 @@ +/* We used to ICE because PRE would try to PRE the load of *Note from the + loop. */ + +struct g +{ + int i; +}; +struct f +{ + struct g i; +}; +int GSM_RingNoteGetFullDuration(struct g)__attribute__((const)); +void savewav(struct f *gg) +{ + struct g *Note; + long i = 0,j,length=0; + Note = &gg->i; + for (j=0;j<GSM_RingNoteGetFullDuration(*Note);j++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25861.c b/gcc/testsuite/gcc.c-torture/compile/pr25861.c new file mode 100644 index 000000000..cdd8efbc4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25861.c @@ -0,0 +1,4 @@ +int f(void *a) +{ + return !(&a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26213.c b/gcc/testsuite/gcc.c-torture/compile/pr26213.c new file mode 100644 index 000000000..7a6600c18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26213.c @@ -0,0 +1,15 @@ +void +xnanosleep (_Bool overflow) +{ + struct { int tv_nsec; } ts_sleep; + if (0 <= ts_sleep.tv_nsec) + overflow |= 1; + + for (;;) + { + if (overflow) + ts_sleep.tv_nsec = 0; + if (foo (ts_sleep)) + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26255.c b/gcc/testsuite/gcc.c-torture/compile/pr26255.c new file mode 100644 index 000000000..df3f0d926 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26255.c @@ -0,0 +1,31 @@ +typedef short int16_t; + +int round_sample(int *sum); + +#define MULS(ra, rb) ((ra) * (rb)) + +#define SUM8(sum, op, w, p) \ +{ \ + sum op MULS((w)[0 * 64], p[0 * 64]); \ + sum op MULS((w)[1 * 64], p[1 * 64]); \ + sum op MULS((w)[2 * 64], p[2 * 64]); \ + sum op MULS((w)[3 * 64], p[3 * 64]); \ + sum op MULS((w)[4 * 64], p[4 * 64]); \ + sum op MULS((w)[5 * 64], p[5 * 64]); \ + sum op MULS((w)[6 * 64], p[6 * 64]); \ + sum op MULS((w)[7 * 64], p[7 * 64]); \ +} + +void foo(int *dither_state, int *samples) +{ + int16_t *synth_buf; + const int16_t *w, *p; + int sum; + + sum = *dither_state; + p = synth_buf + 16; + SUM8(sum, +=, w, p); + p = synth_buf + 48; + SUM8(sum, -=, w + 32, p); + *samples = round_sample(&sum); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26425.c b/gcc/testsuite/gcc.c-torture/compile/pr26425.c new file mode 100644 index 000000000..8931b4014 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26425.c @@ -0,0 +1,9 @@ +struct keyring_list { + struct key *keys[0]; +}; +void keyring_destroy(struct keyring_list *keyring, unsigned short a) +{ + int loop; + for (loop = a - 1; loop >= 0; loop--) + key_put(keyring->keys[loop]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26622.c b/gcc/testsuite/gcc.c-torture/compile/pr26622.c new file mode 100644 index 000000000..aea991ece --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26622.c @@ -0,0 +1,11 @@ +/* PR middle-end/26622 + fold_ternary used to create a tree with mismatching types, causing + (const_int 128) to appear in QImode rtx. */ + +unsigned char g; + +unsigned long long +foo (void) +{ + return ((long long) ((g & 0x80) != 0)) << 7; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26626.c b/gcc/testsuite/gcc.c-torture/compile/pr26626.c new file mode 100644 index 000000000..a4e03012b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26626.c @@ -0,0 +1,13 @@ +typedef union { + int d; +} U; + +int rv; +void breakme() +{ + U *rv0; + U *pretmp = (U*)&rv; + rv0 = pretmp; + rv0->d = 42; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26725.c b/gcc/testsuite/gcc.c-torture/compile/pr26725.c new file mode 100644 index 000000000..934042a52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26725.c @@ -0,0 +1,15 @@ +struct { unsigned int num; } *numptr; +void notice (int); +void doit (unsigned int *); + +void +rewrite_finalize_block (int x) +{ + unsigned int *tmp; + while (tmp = (numptr ? &numptr->num : 0), (tmp ? *tmp : 0) > 0) + { + tmp = (numptr ? &numptr->num : 0); + (void) (*tmp ? 0 : notice (x)); + doit (tmp); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26781-1.c b/gcc/testsuite/gcc.c-torture/compile/pr26781-1.c new file mode 100644 index 000000000..028919e52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26781-1.c @@ -0,0 +1,11 @@ +void zconfdump(void) +{ + char *p, *p2; + for (p2 = p; p2; ) + { + char __a0, __a1, __a2; + __a0 = ((__const char *) ("\"\\"))[0]; + if (__a0) + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26781-2.c b/gcc/testsuite/gcc.c-torture/compile/pr26781-2.c new file mode 100644 index 000000000..47168fdc6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26781-2.c @@ -0,0 +1,11 @@ +void zconfdump(__SIZE_TYPE__ i) +{ + for (;;) + { + char __a0; + __a0 = ("\"\\")[i]; + if (__a0) + return; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26833.c b/gcc/testsuite/gcc.c-torture/compile/pr26833.c new file mode 100644 index 000000000..76c201c6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26833.c @@ -0,0 +1,19 @@ +void yasm_lc3b__parse_insn( int num_info, int *num_operands + , int *operands, int op) +{ + int found = 0; + int i; + for (; num_info>0 && !found; num_info--) + { + int mismatch = 0; + for(i = 0;op && (i<*num_operands)&& !mismatch; i++) + { + if (!(int)(operands[i] & 0x1)) + mismatch = 1; + if (mismatch) + break; + } + if (!mismatch) + found = 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26840.c b/gcc/testsuite/gcc.c-torture/compile/pr26840.c new file mode 100644 index 000000000..8d864a295 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26840.c @@ -0,0 +1,42 @@ +extern int f1 (void **); +extern void f2 (void *); + +struct s +{ + unsigned char field1; + int field2; +}; + +static inline struct s * +get_globals (void) +{ + struct s * r; + void * rr; + + if (f1 (&rr)) + return 0; + r = rr; + if (! r) + { + extern struct s t; + r = &t; + } + r->field1 = 1; + return r; +} + +void +atexit_common (const void *dso) +{ + struct s *g = get_globals (); + + if (! g) + return; + if (g->field1) + { + g->field2 = 0; + f2 (g); + } + else + f2 (g); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27087.c b/gcc/testsuite/gcc.c-torture/compile/pr27087.c new file mode 100644 index 000000000..3add13bcb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27087.c @@ -0,0 +1,23 @@ +extern int ptbl[4]; +extern int ctbl[4]; + +void doViews(void) { + int *c = ctbl, *p = ptbl; + while (1) + { + p++; + c++; + if (*p) + { + if (c == p) + { + if (*c) + return; + } + else + return; + } + } + + g(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27282.c b/gcc/testsuite/gcc.c-torture/compile/pr27282.c new file mode 100644 index 000000000..ab6636650 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27282.c @@ -0,0 +1,17 @@ +/* This test used to ICE on PowerPC at -O due to combine GEN_INT bug. */ +typedef struct _ColRowInfo ColRowInfo; +typedef struct { } +GnmSheetRange; +struct _ColRowInfo +{ + float size_pts; + unsigned margin_a:3; + unsigned margin_b:3; + unsigned visible:1; +}; +colrow_equal (ColRowInfo const *a, ColRowInfo const *b) +{ + return a->size_pts == b->size_pts && a->margin_a == b->margin_a + && a->visible == b->visible; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27341-1.c b/gcc/testsuite/gcc.c-torture/compile/pr27341-1.c new file mode 100644 index 000000000..b77e937b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27341-1.c @@ -0,0 +1,7 @@ +extern double R_NaReal; +void z_atan2 (double _Complex * r, double _Complex * ccs) +{ + if (*ccs == 0) + __imag__ *r = R_NaReal; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27341-2.c b/gcc/testsuite/gcc.c-torture/compile/pr27341-2.c new file mode 100644 index 000000000..e6be1e471 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27341-2.c @@ -0,0 +1,8 @@ +void zgemm_ (const int*, const double*); +extern void matmul_c8 (_Complex double * dest) +{ + const int ldc = 0; + const double zero = 0; + zgemm_ ( &zero, &ldc); + dest[1] += 1 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27373.c b/gcc/testsuite/gcc.c-torture/compile/pr27373.c new file mode 100644 index 000000000..bf6217471 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27373.c @@ -0,0 +1,40 @@ +typedef struct atype +{ + float bg[1], cg[1]; + _Bool ant; +}atype; + + +void cp_assert(_Bool*, float*, int*, _Bool*); + +void f(atype **rng_stream, int *error, float u) +{ + _Bool t = *rng_stream != 0; + float routinep; + _Bool failure; + cp_assert ( &t, &routinep, error, &failure); + if (failure == 0) + { + typedef float ty[1]; + ty *tt = &((*rng_stream)->bg); + int i = 1; + + do + { + (*tt)[i - 1] = u; + i ++; + }while (i > 1); + { + ty *tt = &(*rng_stream)->cg; + int i = 1; + + do + { + (*tt)[i - 1] = u; + i ++; + }while (i > 1); + } + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27528.c b/gcc/testsuite/gcc.c-torture/compile/pr27528.c new file mode 100644 index 000000000..040049127 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27528.c @@ -0,0 +1,40 @@ +/* Check that constant constraints like "i", "n" and "s" can be used in + cases where the operand is an initializer constant. */ +/* { dg-require-effective-target nonpic } */ + +int x[2] = { 1, 2 }; + +#ifdef __OPTIMIZE__ +static inline void __attribute__((__always_inline__)) +insn1 (int x) +{ + asm volatile ("" :: "n" (x), "i" (x)); +} + +static inline void __attribute__((__always_inline__)) +insn2 (const void *x) +{ + asm volatile ("" :: "s" (x), "i" (x)); +} +#endif + +void +foo (void) +{ +#ifdef __OPTIMIZE__ + insn1 (2); + insn1 (2); + insn1 (400); + insn1 (__LINE__); + insn2 (x); + insn2 (x); + insn2 (&x[1]); + insn2 ("string"); +#endif + asm volatile ("" :: "s" (x), "i" (x)); + /* At the time of writing, &x[1] is decomposed before reaching expand + when compiling with -O0. */ + asm volatile ("" :: "s" ("string"), "i" ("string")); + asm volatile ("" :: "s" (__FILE__), "i" (__FILE__)); + asm volatile ("" :: "s" (__FUNCTION__), "i" (__FUNCTION__)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27571.c b/gcc/testsuite/gcc.c-torture/compile/pr27571.c new file mode 100644 index 000000000..af66369c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27571.c @@ -0,0 +1,27 @@ +/* PR target/27571 + alpha_does_function_need_gp did not properly skip jump table insns */ + +int r3isseparator(int); +void r3isdigit(int); +void r3decimalvalue(int); + +void r7todouble(int *storage, int *count) { + int i = 0; + int state = 0; + int cc = 0; + while (i > *count) { + cc = *storage; + switch (state) { + case 0: + if (r3isseparator(cc)) + state = 1; + case 1: + r3isdigit(cc); + case 2: + case 5: + case 6: + r3decimalvalue(cc); + } + i++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27863.c b/gcc/testsuite/gcc.c-torture/compile/pr27863.c new file mode 100644 index 000000000..86abc0686 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27863.c @@ -0,0 +1,28 @@ +/* This test used to ICE on IA64. */ +long stack[100]; +int main(int argc,char**argv,char **envp) +{ + long *esp=stack; + static void* jarray[]={ &&KeyCtrlKV }; + *++esp=(long)&&_loc0; + goto SetTermStruc; + _loc0:; + *++esp=(long)&&_loc1; + _loc1:; +*++esp=(long)&&_loc35; + _loc35:; +goto *(*esp--); +*++esp=(long)&&_loc36; + _loc36:; +*++esp=(long)&&_loc37; + _loc37:; +KeyCtrlKV: +*++esp=(long)&&_loc66; +_loc66:; +*++esp=(long)&&_loc106; + _loc106:; +*++esp=(long)&&_loc119; + _loc119:; +SetTermStruc: + goto *(*esp--); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27889.c b/gcc/testsuite/gcc.c-torture/compile/pr27889.c new file mode 100644 index 000000000..4e76caa56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27889.c @@ -0,0 +1,13 @@ +/* { dg-require-effective-target trampolines } */ + +void h(void (*)(void)); +_Complex int g (void) +{ + _Complex int x; + void f(void) + { + x = x + x; + } + h(f); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27907.c b/gcc/testsuite/gcc.c-torture/compile/pr27907.c new file mode 100644 index 000000000..575ac6a77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27907.c @@ -0,0 +1,23 @@ +typedef double fann_type; +typedef struct { } _G_fpos64_t; +struct fann_neuron +{ + fann_type value; +} +__attribute__ ((packed)); +struct fann_layer +{ + struct fann_neuron *last_neuron; +}; +struct fann +{ + struct fann_layer *first_layer; +}; +fann_run (struct fann *ann, fann_type * input) +{ + struct fann_layer *layer_it, *layer_it2, *last_layer; + for (layer_it = ann->first_layer + 1; layer_it != last_layer; layer_it++) + { + ((layer_it - 1)->last_neuron - 1)->value = 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28489.c b/gcc/testsuite/gcc.c-torture/compile/pr28489.c new file mode 100644 index 000000000..766880fef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28489.c @@ -0,0 +1,48 @@ +typedef int c_int; +union c_insn +{ + void (*op) (); + c_int *mem; + c_int imm; +}; +static union c_insn c_stack[((0x100 + 4) * 4)]; +static struct c_ident *c_funcs; +static void (*c_op_bz) (); +static void c_direct (union c_insn *addr); +c_compile (int (*ext_getchar) (), void (*ext_rewind) (), + struct c_ident *externs) +{ + c_direct (((void *) 0)); +} +static void +c_direct (union c_insn *addr) +{ + union c_insn *pc = addr; + union c_insn *sp = c_stack; + c_int imm = 0; + static void *ops[] = { + &&op_index, &&op_assign, &&op_add_a, &&op_sub_a, &&op_mul_a, &&op_div_a, + &&op_mod_a, &&op_or_a, &&op_xor_a, &&op_and_a, &&op_shl_a, &&op_shr_a, + }; + { + c_op_bz = &&op_bz; + } + goto *(pc++)->op; +op_bz:if (imm) + { + } +op_push_imm_imm:(sp - 2)->imm = imm; + goto *(pc - 1)->op; +op_index:imm = *((sp - 3)->mem += imm); +op_assign:*(sp - 3)->mem = imm; +op_add_a:imm = *(sp - 3)->mem += imm; +op_sub_a:imm = *(sp - 3)->mem -= imm; +op_mul_a:imm = *(sp - 3)->mem *= imm; +op_div_a:imm = *(sp - 3)->mem /= imm; +op_mod_a:imm = *(sp - 3)->mem %= imm; +op_or_a:imm = *(sp - 3)->mem |= imm; +op_xor_a:imm = *(sp - 3)->mem ^= imm; +op_and_a:imm = *(sp - 3)->mem &= imm; +op_shl_a:imm = *(sp - 3)->mem <<= imm; +op_shr_a:imm = *(sp - 3)->mem >>= imm; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28675.c b/gcc/testsuite/gcc.c-torture/compile/pr28675.c new file mode 100644 index 000000000..0d7835373 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28675.c @@ -0,0 +1,38 @@ +struct fb_cmap { + unsigned int start; + unsigned int len; + unsigned short *red; + unsigned short *green; + unsigned short *blue; + unsigned short *transp; +}; + +typedef struct { + int r; + int g; + int b; + int a; +} rgba_t; + +static unsigned int cmap_len; + +extern unsigned int red_len, green_len, blue_len, alpha_len; +extern struct fb_cmap fb_cmap; +extern rgba_t *clut; +extern int fb_set_cmap(void); + +void directcolor_update_cmap(void) +{ + unsigned int i; + + for (i = 0; i < cmap_len; i++) { + if (i < red_len) + fb_cmap.red[i] = clut[i].r; + if (i < green_len) + fb_cmap.green[i] = clut[i].g; + if (i < blue_len) + fb_cmap.blue[i] = clut[i].b; + if (fb_cmap.transp && i < alpha_len) + fb_cmap.transp[i] = clut[i].a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28776-1.c b/gcc/testsuite/gcc.c-torture/compile/pr28776-1.c new file mode 100644 index 000000000..a37fb6fe1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28776-1.c @@ -0,0 +1,16 @@ +typedef struct dw_fde_struct +{ + int decl; +} *dw_fde_ref; +dw_fde_ref fde_table; +unsigned fde_table_in_use; +void output_call_frame_info (void) +{ + unsigned int i; + dw_fde_ref fde; + for (i = 0; i < fde_table_in_use; i++) + { + fde = &fde_table[i]; + tree_contains_struct_check_failed (fde_table[i].decl); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28776-2.c b/gcc/testsuite/gcc.c-torture/compile/pr28776-2.c new file mode 100644 index 000000000..61a5d37df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28776-2.c @@ -0,0 +1,26 @@ +typedef struct RangeCoder +{ + unsigned char one_state[256]; +} RangeCoder; +static inline void put_rac(RangeCoder *c, unsigned char* const state) +{ + *state= c->one_state[*state]; +} +typedef struct PlaneContext{ + unsigned (*state)[32]; +} PlaneContext; +static inline void put_symbol(RangeCoder *c, unsigned char *state) +{ + int i; + const int e; + put_rac(c, state); + for(i=e-1; i>=0; i--) + put_rac(c, state+22+i); +} +int encode_line(void) +{ + PlaneContext * const p; + RangeCoder * const c; + int a; + put_symbol(c, p->state[a]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28905.c b/gcc/testsuite/gcc.c-torture/compile/pr28905.c new file mode 100644 index 000000000..83a381ab8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28905.c @@ -0,0 +1,11 @@ +/* We used to ICE here because after VRP we ended up with + non-compatible ranges in a value-range equivalences set. */ +void code_comment (int size) +{ + int i; + for (i = 0; i < size; i++) + if (i) + if (i < 0) + if (i < 0) + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29128.c b/gcc/testsuite/gcc.c-torture/compile/pr29128.c new file mode 100644 index 000000000..2afeae3ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29128.c @@ -0,0 +1,28 @@ +typedef unsigned long Eterm; +process_main (void) +{ + register Eterm x0; + register Eterm *reg = ((void *) 0); + register Eterm *I = ((void *) 0); + static void *opcodes[] = { + &&lb_allocate_heap_zero_III, + &&lb_allocate_init_tIy, &&lb_allocate_zero_tt + }; +lb_allocate_heap_III:{ + Eterm *next; + goto *(next); + } +lb_allocate_heap_zero_III:{ + } +lb_allocate_init_tIy:{ + } +lb_allocate_zero_tt:{ + Eterm *next; + { + Eterm *tmp_ptr = ((Eterm *) (((x0)) - 0x1)); + (*(Eterm *) (((unsigned char *) reg) + (I[(0) + 1]))) = ((tmp_ptr)[0]); + x0 = ((tmp_ptr)[1]); + } + goto *(next); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29201.c b/gcc/testsuite/gcc.c-torture/compile/pr29201.c new file mode 100644 index 000000000..f0f4c404c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29201.c @@ -0,0 +1,116 @@ +/* { dg-do assemble { target ia64-*-* } } */ +typedef int gint; +typedef gint gboolean; +typedef unsigned int guint; +typedef struct _MetaRectangle MetaRectangle; +struct _MetaRectangle +{ + int x; + int y; +}; +typedef struct _MetaDisplay MetaDisplay; +typedef struct _MetaFrame MetaFrame; +typedef struct _MetaWindow MetaWindow; +typedef struct +{ + int win_gravity; +} +XSizeHints; +typedef enum +{ + META_DEBUG_FOCUS = 1 << 0, META_DEBUG_WORKAREA = 1 << 1, META_DEBUG_STACK = + 1 << 6, META_DEBUG_WINDOW_OPS = 1 << 7, META_DEBUG_GEOMETRY = + 1 << 20, META_DEBUG_EDGE_RESISTANCE = 1 << 21 +} +MetaStackLayer; +struct _MetaWindow +{ + MetaDisplay *display; + MetaFrame *frame; + guint user_has_move_resized:1; + MetaRectangle user_rect; + XSizeHints size_hints; +}; +void meta_window_get_position (MetaWindow * window, int *x, int *y); +typedef struct _MetaFrameGeometry MetaFrameGeometry; +struct _MetaFrameGeometry +{ +}; +struct _MetaFrame +{ + MetaWindow *window; + MetaRectangle rect; + int child_x; + int child_y; +}; +typedef enum +{ + META_IS_CONFIGURE_REQUEST = 1 << 0, META_DO_GRAVITY_ADJUST = + 1 << 3, META_IS_RESIZE_ACTION = 1 << 4 +} +MetaMoveResizeFlags; +adjust_for_gravity (MetaWindow * window, MetaFrameGeometry * fgeom, + gboolean coords_assume_border, int gravity, + MetaRectangle * rect) +{ + int ref_x, ref_y; + int child_x, child_y; + int frame_width, frame_height; + switch (gravity) + { + case 1: + ref_x = rect->x; + } + switch (gravity) + { + case 1: + rect->y = ref_y + child_y; + case 2: + rect->x = ref_x - frame_width / 2 + child_x; + break; + case 3: + case 5: + case 6: + rect->x = ref_x - frame_width + child_x; + } +} +meta_window_move_resize_internal (MetaWindow * window, + MetaMoveResizeFlags flags, + int resize_gravity, int root_x_nw, + int root_y_nw, int w, int h) +{ + unsigned int mask; + MetaFrameGeometry fgeom; + gboolean need_resize_client = (0); + gboolean is_configure_request; + MetaRectangle new_rect; + MetaRectangle old_rect; + { + adjust_for_gravity (window, window->frame ? &fgeom : ((void *) 0), + is_configure_request, window->size_hints.win_gravity, + &new_rect); + } + meta_window_constrain (window, window->frame ? &fgeom : ((void *) 0), flags, + resize_gravity, &old_rect, &new_rect); + if (mask != 0) + { + { + meta_topic_real (META_DEBUG_GEOMETRY, + need_resize_client ? "true" : "false"); + } + } + { + window->user_has_move_resized = (!(0)); + meta_window_get_position (window, &window->user_rect.x, + &window->user_rect.y); + } +} +void +meta_window_get_position (MetaWindow * window, int *x, int *y) +{ + if (window->frame) + { + *x = window->frame->rect.x + window->frame->child_x; + *y = window->frame->rect.y + window->frame->child_y; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29241.c b/gcc/testsuite/gcc.c-torture/compile/pr29241.c new file mode 100644 index 000000000..6db15c1c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29241.c @@ -0,0 +1,15 @@ +static inline __attribute__((always_inline)) void ip_finish_output2(){} +void ip_fragment(void (*)(void)); +static inline __attribute__((always_inline)) void ip_finish_output() +{ + ip_fragment(ip_finish_output2); + ip_finish_output2(); +} +void ip_mc_output() +{ + ip_finish_output(); +} +void ip_output() +{ + ip_finish_output(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29250.c b/gcc/testsuite/gcc.c-torture/compile/pr29250.c new file mode 100644 index 000000000..970af329d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29250.c @@ -0,0 +1,32 @@ +/* We used to ICE because EXPAND_SUM was being used for all recursive calls + to expand_expr. */ +struct TSparseEntry +{ + int feat_index; + double entry; +}; + +struct TSparse +{ + int vec_index; + int num_feat_entries; + struct TSparseEntry *features; +}; + +void +get_full_feature_matrix (struct TSparse* sparse_feature_matrix, int num_vec) +{ + double *fm; + int v, f; + + for (v=0; v < num_vec; v++) + { + for (f=0; f < sparse_feature_matrix[v].num_feat_entries; f++) + { + long long offs = sparse_feature_matrix[v].vec_index + + sparse_feature_matrix[v].features[f].feat_index; + fm[offs] = sparse_feature_matrix[v].features[f].entry; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29945.c b/gcc/testsuite/gcc.c-torture/compile/pr29945.c new file mode 100644 index 000000000..775af29ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29945.c @@ -0,0 +1,8 @@ +/* This test used to ICE on the SPU target. */ +extern const char *__ctype_ptr; + +parse_real (unsigned char c) +{ + if ((__ctype_ptr[c]&04) && c != '.') + unget_char ( c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30132.c b/gcc/testsuite/gcc.c-torture/compile/pr30132.c new file mode 100644 index 000000000..adffae772 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30132.c @@ -0,0 +1,5 @@ +double testit(double _Complex* t) +{ + return *t==0.0?0.0:-*t; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30311.c b/gcc/testsuite/gcc.c-torture/compile/pr30311.c new file mode 100644 index 000000000..85ce75099 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30311.c @@ -0,0 +1,16 @@ +/* ICE in subreg_get_info: bug 30311. */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +inline double bar(double x) +{ + long double d; + __asm__ ("" : "=t" (d) : "0" (x)); + return d; +} + +double foo(double x) +{ + if (x) + return bar(x); + else + return bar(x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30338.c b/gcc/testsuite/gcc.c-torture/compile/pr30338.c new file mode 100644 index 000000000..2d6245d01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30338.c @@ -0,0 +1,14 @@ +/* We used to do folding with mismatched types which caused us to + infinitely loop in comparison foldings. */ + +extern char *grub_scratch_mem; +int testload_func (char *arg, int flags) +{ + int i; + for (i = 0; i < 0x10ac0; i++) + if (*((unsigned char *) ((0x200000 + i + (int) grub_scratch_mem))) + != *((unsigned char *) ((0x300000 + i + (int) grub_scratch_mem)))) + return 0; + return 1; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30433.c b/gcc/testsuite/gcc.c-torture/compile/pr30433.c new file mode 100644 index 000000000..1f0edd079 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30433.c @@ -0,0 +1,2 @@ +int f = (_Complex float)(0.5) == 0.5; + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30564-1.c b/gcc/testsuite/gcc.c-torture/compile/pr30564-1.c new file mode 100644 index 000000000..6c373f74b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30564-1.c @@ -0,0 +1,15 @@ +static int spready[] = {0, 1, 2, 3}; +void explosion_map (int y) +{ + int i; + for (i = 0; i < 4; i++) + if (y * spready[i] < 0) + break; +} +void explosion (void) +{ + int i; + explosion_map (0); + for (i = 0; i < 2; i++) + continue; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30564-2.c b/gcc/testsuite/gcc.c-torture/compile/pr30564-2.c new file mode 100644 index 000000000..403f39661 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30564-2.c @@ -0,0 +1,12 @@ + +static int RawOrEnc = 0; +static inline void addpair(int fp, int un) +{ + if (RawOrEnc == 0 && fp != un) + RawOrEnc = 1; +} +int f(int un0, char *a, unsigned int __s2_len) +{ + addpair(un0, un0); + __s2_len < 4 ? __builtin_strcmp (a, "-") : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30984.c b/gcc/testsuite/gcc.c-torture/compile/pr30984.c new file mode 100644 index 000000000..265a6f361 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30984.c @@ -0,0 +1,7 @@ +int fs_exec(int ino) +{ + void *src = 0; + if (ino) + src = (void*)0xe000; + goto *src; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31034.c b/gcc/testsuite/gcc.c-torture/compile/pr31034.c new file mode 100644 index 000000000..affad9515 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31034.c @@ -0,0 +1,14 @@ +static inline int +mod (int a, int n) +{ + return a >= n ? a % n : a; +} +void dpara(int); +void opticurve (int m) +{ + int i; + for (i = 0; i < m; i++) + { + dpara(mod (i - 1, m)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31345-1.c b/gcc/testsuite/gcc.c-torture/compile/pr31345-1.c new file mode 100644 index 000000000..fb4d8034c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31345-1.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/31345 + This caused a crash in VRP when dealing with overflow infinities. */ + +void +dpsnaffle (const char *kbuf) +{ + int hash, thash, head[2], off; + { + int _DP_i; + (hash) = 19780211; + { + (hash) = (hash) + (kbuf)[_DP_i]; + } + (hash) = ((hash) * 43321879) & 0x7FFFFFFF; + } + while (off != 0) + { + if (hash > thash) {} + else if (hash < thash) + { + off = head[2]; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31541.c b/gcc/testsuite/gcc.c-torture/compile/pr31541.c new file mode 100644 index 000000000..0cac26ed0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31541.c @@ -0,0 +1,9 @@ +typedef unsigned char Uchar; +struct scsi_mode_header { + unsigned char sense_data_len : 8; +}; +int f(void) +{ + struct scsi_mode_header md; +return *(Uchar*)&md; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31703.c b/gcc/testsuite/gcc.c-torture/compile/pr31703.c new file mode 100644 index 000000000..e463205a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31703.c @@ -0,0 +1,11 @@ +typedef unsigned long long HARD_REG_ELT_TYPE; +static HARD_REG_ELT_TYPE reload_reg_used_in_output_addr[30]; +int reload_reg_reaches_end_p (unsigned int regno, int opnum) +{ + int i; + for (i = opnum + 1; i < opnum; i++) + if (reload_reg_used_in_output_addr[i] + & ((HARD_REG_ELT_TYPE)1 << regno)) + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31710.c b/gcc/testsuite/gcc.c-torture/compile/pr31710.c new file mode 100644 index 000000000..0c8562dbc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31710.c @@ -0,0 +1,6 @@ +typedef short SHORT; +struct v { SHORT i; }; +void f(struct v *pin, struct v *pout) { + if (pin->i == (-0x7fff)-1) + pout->i = -pin->i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31797.c b/gcc/testsuite/gcc.c-torture/compile/pr31797.c new file mode 100644 index 000000000..97958f389 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31797.c @@ -0,0 +1,31 @@ +struct GTeth_desc +{ + unsigned ed_cmdsts; +}; +struct GTeth_softc +{ + struct GTeth_desc txq_desc[32]; + unsigned int txq_fi; + unsigned int txq_nactive; +}; + +void +GTeth_txq_free (struct GTeth_softc *sc) +{ + struct GTeth_desc *txd = &sc->txq_desc[0]; + txd->ed_cmdsts &= ~(1U << (31)); +} +void +GTeth_txq_done (struct GTeth_softc *sc) +{ + while (sc->txq_nactive > 0) + { + volatile struct GTeth_desc *txd = &sc->txq_desc[sc->txq_fi]; + if (txd->ed_cmdsts) + { + if (sc->txq_nactive == 1) + return; + } + GTeth_txq_free (sc); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31953.c b/gcc/testsuite/gcc.c-torture/compile/pr31953.c new file mode 100644 index 000000000..667c9ae88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31953.c @@ -0,0 +1,14 @@ +struct WView +{ + int hexedit_mode:1; +}; +toggle_hexedit_mode (struct WView *view) +{ + if (view->hexedit_mode) + { + } + else + { + view->hexedit_mode = !view->hexedit_mode; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32139.c b/gcc/testsuite/gcc.c-torture/compile/pr32139.c new file mode 100644 index 000000000..7b8522f51 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32139.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/32139 */ +int foo (void); +int bar (void) __attribute__ ((const)); + +int +test (int x) +{ + int a = (x == 10000 ? foo : bar) (); + int b = (x == 10000 ? foo : bar) (); + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32169.c b/gcc/testsuite/gcc.c-torture/compile/pr32169.c new file mode 100644 index 000000000..29d3022df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32169.c @@ -0,0 +1,17 @@ +void f(char); +static inline +void * __memset_generic(char c) +{ + f(c); +} +int prepare_startup_playback_urb( + int b, + int c +) +{ + char d; + if (b) + __memset_generic(c == ( 1) ? 0x80 : 0); + else + __memset_generic (c == ( 1) ? 0x80 : 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32349.c b/gcc/testsuite/gcc.c-torture/compile/pr32349.c new file mode 100644 index 000000000..df725afbf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32349.c @@ -0,0 +1,26 @@ +/* { dg-options "-fmodulo-sched" } */ + + +extern long *x1, *x2, *x3; + +int +foo () +{ + /* Switching the following two lines prevents the ICE. */ + long *p1, *p2; + long m, n, i; + + p1 = x1; + p2 = x2; + n = 0; + for (i = *x3; 0 < i; i--) + { + m = (*p1++) ^ (*p2++); + m = (m & 0x55555555) + ((m >> 1) & 0x55555555); + m = (m & 0x33333333) + ((m >> 2) & 0x33333333); + m = (m + (m >> 4)) & 0x0f0f0f0f; + m = (m + (m >> 8)); + n += m; + } + return n; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32355.c b/gcc/testsuite/gcc.c-torture/compile/pr32355.c new file mode 100644 index 000000000..e88cf5cf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32355.c @@ -0,0 +1,31 @@ +typedef struct +{ +} +__sigset_t; +typedef struct +{ + char coredump; +} +EMode; +extern EMode Mode; +struct sigaction +{ + __sigset_t sa_mask; + int sa_flags; +}; +doSignalsSetup (void) +{ + static const int signals[] = { + 1, 2 , 3, 4, 6, 8, 11, 13, 14, 15, 10, 12, 17, 7 + }; + unsigned int i, sig; + struct sigaction sa; + for (i = 0; i < sizeof (signals) / sizeof (int); i++) + { + sig = signals[i]; + if (Mode.coredump && (sig == 4 || sig == 8)) + continue; + sa.sa_flags = (sig == 17); + sigemptyset (&sa.sa_mask); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32372.c b/gcc/testsuite/gcc.c-torture/compile/pr32372.c new file mode 100644 index 000000000..cead1ca00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32372.c @@ -0,0 +1,21 @@ +typedef struct AVCodecContext +{ + int flags; + void *priv_data; + char codec_name[32]; +} +AVCodecContext; +typedef struct ScanTable +{ + int obmc; + int umvplus; + int h263_aic; +} +MpegEncContext; +MPV_encode_init (AVCodecContext *avctx) +{ + MpegEncContext *s = avctx->priv_data; + s->umvplus = (avctx->flags & 0x02000000) ? 1 : 0; + s->h263_aic = (avctx->flags & 0x01000000) ? 1 : 0; + s->h263_aic = s->obmc || s->umvplus; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32399.c b/gcc/testsuite/gcc.c-torture/compile/pr32399.c new file mode 100644 index 000000000..cc2b1b189 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32399.c @@ -0,0 +1,16 @@ +void f(unsigned char *src, unsigned char *dst, int num, unsigned char *pos, unsigned char *diffuse, int hasdiffuse, unsigned char *specular, int hasspecular) { + int i; + + for(i=num;i--;) { + float *p = (float *) ((__SIZE_TYPE__) dst + (__SIZE_TYPE__) pos); + if(hasdiffuse) { + unsigned int *dstColor = (unsigned int *) (dst + i + (__SIZE_TYPE__) diffuse); + *dstColor = * (unsigned int *) ( ((__SIZE_TYPE__) src + (__SIZE_TYPE__) diffuse) + i); + } + if(hasspecular) { + unsigned int *dstColor = (unsigned int *) (dst + i + (__SIZE_TYPE__) specular); + *dstColor = * (unsigned int *) ( ((__SIZE_TYPE__) src + (__SIZE_TYPE__) specular) + i); + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32453.c b/gcc/testsuite/gcc.c-torture/compile/pr32453.c new file mode 100644 index 000000000..bdabac76d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32453.c @@ -0,0 +1,11 @@ +void ucs2reverse_internal_loop_single (long *irreversible, int foo) +{ + unsigned char bytebuf[2]; + const unsigned char *inptr = bytebuf; + if (irreversible == (void *)0) + ; + else + inptr += 2; + if (inptr != bytebuf) + ((inptr - bytebuf > foo) ? (void) (0) : __assert_fail ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32482.c b/gcc/testsuite/gcc.c-torture/compile/pr32482.c new file mode 100644 index 000000000..9f0e3bfeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32482.c @@ -0,0 +1,23 @@ +typedef struct { unsigned long bits[((((1 << 0))+32 -1)/32)]; } nodemask_t; +static inline __attribute__((always_inline)) +int bitmap_empty(const unsigned long *src, int nbits) +{ + return ! (*src & ( ((nbits) % 32) ? (1UL<<((nbits) % 32))-1 : ~0UL )); +} +static inline __attribute__((always_inline)) +int __nodes_empty(const nodemask_t *srcp, int nbits) +{ + return bitmap_empty(srcp->bits, nbits); +} +extern nodemask_t node_online_map; +void drain_array(void); +void drain_cpu_caches(void) +{ + int node; + if (!__nodes_empty(&(node_online_map), (1 << 0))) + for (((node)) = 0; ((node)) < 1; ((node))++) + { + } + if (!__nodes_empty(&(node_online_map), (1 << 0))) + drain_array(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32571.c b/gcc/testsuite/gcc.c-torture/compile/pr32571.c new file mode 100644 index 000000000..9592e3f36 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32571.c @@ -0,0 +1,38 @@ + +struct list_head { + struct list_head *next, *prev; +}; +struct ib_fmr { + int *device; + struct list_head list; +}; +static inline +struct mthca_fmr *to_mfmr(struct ib_fmr *ibmr) +{ + const struct ib_fmr *__mptr = (ibmr); + return (struct mthca_fmr *)( (char *)__mptr ); +} +void mthca_unmap_fmr(struct list_head *fmr_list) +{ + struct ib_fmr *fmr; + if (mthca_is_memfree()) + { + for (fmr = + ({ const struct list_head *__mptr = ((fmr_list)->next); (struct ib_fmr *)( +(char *)__mptr - 8 );}); + &fmr->list != (fmr_list); + fmr = ({ const struct list_head *__mptr = (fmr->list.next); (struct ib_fmr +*)( (char *)__mptr - 8);}) + ) + mthca_arbel_fmr_unmap(to_mfmr(fmr)); + } + else + for (fmr = + ({ const struct list_head *__mptr = ((fmr_list)->next); (struct ib_fmr *)( +(char *)__mptr - 8);}); + &fmr->list != (fmr_list); + fmr = ({ const struct list_head *__mptr = (fmr->list.next); (struct ib_fmr +*)( (char *)__mptr - 8);}) + ) + mthca_tavor_fmr_unmap(to_mfmr(fmr)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32584.c b/gcc/testsuite/gcc.c-torture/compile/pr32584.c new file mode 100644 index 000000000..403ea9b12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32584.c @@ -0,0 +1,74 @@ +typedef __SIZE_TYPE__ size_t; +/* Kludge */ +#define unsigned +typedef __SIZE_TYPE__ __ssize_t; +#undef unsigned +typedef struct +{ +} __mbstate_t; +typedef struct +{ +} _G_fpos64_t; +enum +{ + __GCONV_INTERNAL_ERROR +}; +typedef int (*__gconv_trans_fct) (struct __gconv_step *, + size_t *); +typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *, + unsigned char *, unsigned char *); +struct __gconv_trans_data +{ +}; +struct _IO_marker { +}; +typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf, + size_t __n); +typedef struct blockbox { +} *BBOXPTR, BBOX ; +typedef struct netbox { +} *NBOXPTR, NBOX ; +typedef struct termbox { + struct termbox *nextterm ; +} *TEBOXPTR, TEBOX ; +typedef struct tilebox { + TEBOXPTR termsptr ; +} +*TIBOXPTR , +TIBOX ; +typedef struct cellbox { + TIBOXPTR tileptr ; +} +*CBOXPTR , +CBOX ; +typedef struct dimbox { +} +DBOX ; +typedef struct rowbox { +} ROWBOX ; +typedef struct binbox { +} +CHANGRDBOX ; +extern int numcells ; +extern int numterms ; +sortpin() +{ +int j , n , cell ; +CBOXPTR ptr ; +TIBOXPTR tile ; +TEBOXPTR term , *xpptr ; +for( cell = 1 ; cell <= numcells + numterms ; cell++ ) { + if( ( tile = ptr->tileptr ) == (TIBOXPTR) ((void *)0) ) { + } + n = 0 ; + for( term = tile->termsptr ; term != (TEBOXPTR) ((void *)0) ; + term = term->nextterm ) { + xpptr[ ++n ] = term ; + } + xpptr[ n + 1 ] = (TEBOXPTR) ((void *)0) ; + ptr->tileptr->termsptr = xpptr[ 1 ] ; + for( j = 1 ; j <= n ; j++ ) { + } +} +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32606.c b/gcc/testsuite/gcc.c-torture/compile/pr32606.c new file mode 100644 index 000000000..91348c40e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32606.c @@ -0,0 +1,30 @@ +int inb(int); +void is870(unsigned int wkport, unsigned char j) +{ + unsigned int tmport; + unsigned char i; + for (i = 0; i < 16; i++) + { + tmport = wkport + 0x18; + tmport += 0x07; + while ((inb(tmport) & 0x80) == 0) + { + if ((inb(tmport) & 0x01) != 0) + { + tmport -= 0x06; + tmport += 0x06; + } + } + tmport = wkport + 0x14; + tmport += 0x04; + tmport += 0x07; +widep_in1: + if ((j & 0x01) != 0) + { + tmport -= 0x06; + tmport += 0x06; + goto widep_in1; + } + while ((inb(tmport) & 0x80) == 0) {} + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32780.c b/gcc/testsuite/gcc.c-torture/compile/pr32780.c new file mode 100644 index 000000000..cfe64e434 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32780.c @@ -0,0 +1,10 @@ +typedef __SIZE_TYPE__ size_t; +extern void dont_optimize_away(size_t); + +void crashGcc(char*a) +{ + size_t b=(size_t)a - ((size_t)a & 1); + size_t c=(size_t)a - (b & (size_t)a); + dont_optimize_away(b+c); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32796.c b/gcc/testsuite/gcc.c-torture/compile/pr32796.c new file mode 100644 index 000000000..9e0abfb0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32796.c @@ -0,0 +1,6 @@ + + +__SIZE_TYPE__ f (void *ptr) +{ + return ((__SIZE_TYPE__)(ptr)-1) | 1ULL; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32919.c b/gcc/testsuite/gcc.c-torture/compile/pr32919.c new file mode 100644 index 000000000..33956c8c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32919.c @@ -0,0 +1,26 @@ +void _IO_vfprintf_internal ( char *f ) +{ + static const void *const step0_jumps[] = { &&do_form_unknown, &&do_flag_plus, &&do_form_float }; + const void * ptr = step0_jumps[0]; + do { + char spec; + spec = (*++f); + goto *ptr; +do_flag_plus: + read_int (&f); +do_number: + _itoa_word (spec); +do_form_float: + if (ptr != ((void *)0)) + { + spec = 'x'; + goto do_number; + } + if (spec != 'S') + __strnlen (); + return; + do_form_unknown:; + } + while (*f != '\0'); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32920.c b/gcc/testsuite/gcc.c-torture/compile/pr32920.c new file mode 100644 index 000000000..c9b627b12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32920.c @@ -0,0 +1,7 @@ +int a; +void +foo(void) +{ + char buf[10]; + a = a < sizeof(buf) ? a : sizeof (buf); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32988.c b/gcc/testsuite/gcc.c-torture/compile/pr32988.c new file mode 100644 index 000000000..b62004c6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32988.c @@ -0,0 +1,20 @@ +enum zone_type { + ZONE_DMA, + ZONE_NORMAL, + ZONE_MOVABLE, + MAX_NR_ZONES +}; +static unsigned long arch_zone_lowest_possible_pfn[MAX_NR_ZONES]; +static unsigned long arch_zone_highest_possible_pfn[MAX_NR_ZONES]; +void free_area_init_nodes(unsigned long *max_zone_pfn) +{ + enum zone_type i; + for (i = 1; i < MAX_NR_ZONES; i++) + { + if (i == ZONE_MOVABLE) + continue; + unsigned long _x = max_zone_pfn[i]; + unsigned long _y = arch_zone_lowest_possible_pfn[i]; + arch_zone_highest_possible_pfn[i] = _x > _y ? _x : _y; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33122.c b/gcc/testsuite/gcc.c-torture/compile/pr33122.c new file mode 100644 index 000000000..e86254030 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33122.c @@ -0,0 +1,14 @@ +struct dis386 { + const char *x; +}; + +static const struct dis386 float_reg[][2] = { + { { "fadd" }, { "fadd" } }, +}; + +void foo(int i, int j) +{ + const struct dis386 *dp; + + dp = &float_reg[i - 1][j]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33133.c b/gcc/testsuite/gcc.c-torture/compile/pr33133.c new file mode 100644 index 000000000..d1b09640e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33133.c @@ -0,0 +1,50 @@ +static char newshuffle[256 + 16] = { + 0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09, 0x00, 0x01, 0x06, 0x0d, + 0x03, 0x04, 0x0b, 0x0a, 0x02, 0x0c, 0x0e, 0x06, 0x0f, 0x00, 0x01, 0x08, + 0x0d, 0x03, 0x0a, 0x04, 0x09, 0x0b, 0x05, 0x07, 0x05, 0x02, 0x09, 0x0f, + 0x0c, 0x04, 0x0d, 0x00, 0x0e, 0x0a, 0x06, 0x08, 0x0b, 0x01, 0x03, 0x07, + 0x0f, 0x0d, 0x02, 0x06, 0x07, 0x08, 0x05, 0x09, 0x00, 0x04, 0x0c, 0x03, + 0x01, 0x0a, 0x0b, 0x0e, 0x05, 0x0e, 0x02, 0x0b, 0x0d, 0x0a, 0x07, 0x00, + 0x08, 0x06, 0x04, 0x01, 0x0f, 0x0c, 0x03, 0x09, 0x08, 0x02, 0x0f, 0x0a, + 0x05, 0x09, 0x06, 0x0c, 0x00, 0x0b, 0x01, 0x0d, 0x07, 0x03, 0x04, 0x0e, + 0x0e, 0x08, 0x00, 0x09, 0x04, 0x0b, 0x02, 0x07, 0x0c, 0x03, 0x0a, 0x05, + 0x0d, 0x01, 0x06, 0x0f, 0x01, 0x04, 0x08, 0x0a, 0x0d, 0x0b, 0x07, 0x0e, + 0x05, 0x0f, 0x03, 0x09, 0x00, 0x02, 0x06, 0x0c, 0x05, 0x03, 0x0c, 0x08, + 0x0b, 0x02, 0x0e, 0x0a, 0x04, 0x01, 0x0d, 0x00, 0x06, 0x07, 0x0f, 0x09, + 0x06, 0x00, 0x0b, 0x0e, 0x0d, 0x04, 0x0c, 0x0f, 0x07, 0x02, 0x08, 0x0a, + 0x01, 0x05, 0x03, 0x09, 0x0b, 0x05, 0x0a, 0x0e, 0x0f, 0x01, 0x0c, 0x00, + 0x06, 0x04, 0x02, 0x09, 0x03, 0x0d, 0x07, 0x08, 0x07, 0x02, 0x0a, 0x00, + 0x0e, 0x08, 0x0f, 0x04, 0x0c, 0x0b, 0x09, 0x01, 0x05, 0x0d, 0x03, 0x06, + 0x07, 0x04, 0x0f, 0x09, 0x05, 0x01, 0x0c, 0x0b, 0x00, 0x03, 0x08, 0x0e, + 0x02, 0x0a, 0x06, 0x0d, 0x09, 0x04, 0x08, 0x00, 0x0a, 0x03, 0x01, 0x0c, + 0x05, 0x0f, 0x07, 0x02, 0x0b, 0x0e, 0x06, 0x0d, 0x09, 0x05, 0x04, 0x07, + 0x0e, 0x08, 0x03, 0x01, 0x0d, 0x0b, 0x0c, 0x02, 0x00, 0x0f, 0x06, 0x0a, + 0x09, 0x0a, 0x0b, 0x0d, 0x05, 0x03, 0x0f, 0x00, 0x01, 0x0c, 0x08, 0x07, + 0x06, 0x04, 0x0e, 0x02, 0x03, 0x0e, 0x0f, 0x02, 0x0d, 0x0c, 0x04, 0x05, + 0x09, 0x06, 0x00, 0x01, 0x0b, 0x07, 0x0a, 0x08, +}; +void newpassencrypt (char *, char *, char *); +void +newpassencrypt (char *old, char *new, char *out) +{ + char *p, *bx; + char copy[8]; + int i, di, ax; + char cl, dl, ch; + for (i = 0; i < 16; i++) + { + for (bx = old + 7; bx > old; bx--) + { + *bx = ((bx[-1] >> 4) & 0x0f) | ((*bx) << 4); + } + for (di = 0; di < 16; di++) + { + if (newshuffle[di + 0x100] & 1) + ch = ((copy[newshuffle[di + 0x100] / 2] >> 4) & 0x0f); + else + ch = copy[newshuffle[di + 0x100] / 2] & 0x0f; + out[di / 2] |= ((di & 1) ? ch << 4 : ch); + } + memcpy (copy, out, 8); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33146.c b/gcc/testsuite/gcc.c-torture/compile/pr33146.c new file mode 100644 index 000000000..6741fcf5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33146.c @@ -0,0 +1,19 @@ +typedef struct +{ + int end; + int term; +} +jpc_enc_pass_t; +void foo(int numpasses, jpc_enc_pass_t *p) +{ + jpc_enc_pass_t *pass; + jpc_enc_pass_t *termpass; + for (pass = p; pass != termpass; ++pass) + if (!pass->term) + { + termpass = pass; + while (termpass - pass < numpasses && !termpass->term) + ++termpass; + pass->end = termpass->end; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33166.c b/gcc/testsuite/gcc.c-torture/compile/pr33166.c new file mode 100644 index 000000000..a48c529c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33166.c @@ -0,0 +1,10 @@ +static void ConvertAddr (char *saddr, void **addr) +{ + *addr = (void *) &saddr; +} +void DefineSelf (char *addr) +{ + ConvertAddr (addr, (void **) &addr); + if (addr[0] == 127 && addr[3] == 1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33173.c b/gcc/testsuite/gcc.c-torture/compile/pr33173.c new file mode 100644 index 000000000..f599297e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33173.c @@ -0,0 +1,102 @@ +typedef __SIZE_TYPE__ size_t; +typedef struct +{ +} +_G_fpos_t; +extern int printf (__const char *__restrict __format, ...); +extern size_t strlen (__const char *__s) __attribute__ ((__nothrow__)) + __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +typedef struct rend_service_descriptor_t +{ + int patchlevel; + char status_tag[32]; +} +tor_version_t; +test_dir_format (void) +{ + tor_version_t ver1; + { + long v2 = (long) (ver1.patchlevel); + } + { + const char *v1 = (""), *v2 = (ver1.status_tag); + if (!__extension__ ( + { + size_t __s1_len, __s2_len; + (__builtin_constant_p (v1) + && (__s1_len = strlen (v1), __s2_len = + (!((size_t) (const void *) ((v1) + 1) - + (size_t) (const void *) (v1) == 1) + || __s1_len >= 4) + && + (!((size_t) (const void *) ((v2) + 1) - + (size_t) (const void *) (v2) == 1) + || __s2_len >= 4)) ? __builtin_strcmp (v1, + v2) + : (__builtin_constant_p (v1) + && ((size_t) (const void *) ((v1) + 1) - + __s1_len < 4) ? (__builtin_constant_p (v2) + && + ((size_t) (const void *) + (size_t) (const void + *) (v2) == + 1) ? __builtin_strcmp (v1, + v2) + : (__extension__ ( + { + __const + char + *__s2 + = + (__const + char + *) + (v2); + register + __result + = + (((__const unsigned char *) (__const char *) (v1))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) + { + } + __result;} + ))): + (__builtin_constant_p (v2) + && ((size_t) (const void *) ((v2) + 1) - + __s2_len < 4) ? (__builtin_constant_p (v1) + && ((size_t) (const void *) + 1) ? + __builtin_strcmp (v1, + v2) + : (__extension__ ( + { + __const + char + *__s1 + = + (__const + char + *) + (__const + *) + (v1); + register + __result + = + ((__const unsigned char *) (__const char *) (v2))[0]; if (__s2_len > 0 && __result == 0) + { + if + (__s2_len + == + 0) + { + } + } + __result;} + ))): __builtin_strcmp (v1, + v2))));} + )) + { + printf ("."); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33382.c b/gcc/testsuite/gcc.c-torture/compile/pr33382.c new file mode 100644 index 000000000..c939cf7b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33382.c @@ -0,0 +1,95 @@ +typedef __SIZE_TYPE__ size_t; +typedef struct { + int disable; + char *searchconfig[]; +} config_t; +typedef struct { + void *lng; +} arglist_t; +config_t config = { + .searchconfig = { + ((void *) 0)} +}; + +arglist_t arglist[] = { + { + &config.searchconfig[0]} +}; +const int arglistsize = ((int) (sizeof(arglist) / sizeof(arglist_t))); +void show_configuration(char *arg) +{ + int i; + + if (!__extension__( { + size_t + __s1_len, + __s2_len; (__builtin_constant_p(arglist[i].lng) + && (__s1_len = (!((size_t) + (const void *) + 1) + || __s2_len >= 4)) + ? : (__builtin_constant_p(arglist[i].lng) + && ((size_t) + (const void *) + 4) + ? (__builtin_constant_p(arg) + && ((size_t) (const void *) 1) ? + : (__extension__( { + __const * __s2 = + (__const *) + (arg); + register + __result = + (((__const + *) (arglist + [i]. + lng))[0] + - __s2[0]); + if (__s1_len == + 0) { + if (__s1_len == + 0) { + __result = + (((__const + unsigned char + *) (__const + char + *) + (arglist[i]. + lng))[3] - + __s2[3]);} + } + __result;} + ))): + (__builtin_constant_p(arg) + ? + (__builtin_constant_p + (arglist[i].lng) + ? : (__extension__( { + char + __result + = + ((__const + unsigned *) + (arg))[0]; + if + (__s2_len + > 0 + && __result == + 0) { + if (__s2_len > + 1 + && __result + == 0) { + } + } + __result;} + ))): + + + + __builtin_strcmp(arglist[i].lng, + arg))));} + )) + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33614.c b/gcc/testsuite/gcc.c-torture/compile/pr33614.c new file mode 100644 index 000000000..2b835b9dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33614.c @@ -0,0 +1,9 @@ +typedef float V2SF __attribute__ ((vector_size (8))); + +V2SF +foo (int x, V2SF a) +{ + while (x--) + a += (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f}; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33617.c b/gcc/testsuite/gcc.c-torture/compile/pr33617.c new file mode 100644 index 000000000..51c6f1443 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33617.c @@ -0,0 +1,9 @@ +/* { dg-options "-w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ + +typedef float V8SF __attribute__ ((vector_size (32))); +void bar (V8SF); +void +foo (float x) +{ + bar ((V8SF) { x, x, x, x, x, x, x, x }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33641.c b/gcc/testsuite/gcc.c-torture/compile/pr33641.c new file mode 100644 index 000000000..112f70327 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33641.c @@ -0,0 +1,12 @@ +/* This failed with type checking enabled. */ + +typedef enum { one, two } exp; +extern exp pe; +extern char pt[256]; +void psd (void (*f) (void *), void *p); +static void rle (void *e) { } +void +foo (void) +{ + psd ((void (*)(void *)) (rle), (void *) (pt + pe)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33855.c b/gcc/testsuite/gcc.c-torture/compile/pr33855.c new file mode 100644 index 000000000..e678cb341 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33855.c @@ -0,0 +1,27 @@ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ +/* Used to segfault due to cselim not marking the complex temp var + as GIMPLE reg. */ + +typedef struct { + int nsant, nvqd; + _Complex long double *vqd; +} vsorc_t; +vsorc_t vsorc; + +void foo(int next_job, int ain_num, int iped, long t) { + long double zpnorm; + + while (!next_job) + if (ain_num) + { + if (iped == 1) + zpnorm = 0.0; + int indx = vsorc.nvqd-1; + vsorc.vqd[indx] = t*1.0fj; + if (cabsl(vsorc.vqd[indx]) < 1.e-20) + vsorc.vqd[indx] = 0.0fj; + zpnorm = t; + if (zpnorm > 0.0) + iped = vsorc.nsant; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c b/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c new file mode 100644 index 000000000..526112974 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c @@ -0,0 +1,22 @@ +static const char s[] = "ab.cd.efghijk"; + +int +foo (const char *x) +{ + const char *a; + int b = 0; + + a = __builtin_strchr (s, '.'); + if (a == 0) + b = 1; + else if ((a = __builtin_strchr (a + 1, '.')) == 0) + b = 1; + else if (__builtin_strncmp (s, x, a - s)) + b = 1; + else if (__builtin_strncmp (a + 1, x + (a - s + 1), 4) < 0) + b = 1; + + if (b) + return 4; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c b/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c new file mode 100644 index 000000000..9ec49ec97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c @@ -0,0 +1,12 @@ +static const char s[] = "ab.cd.efghijk"; +static const char t[] = "abcde"; + +long +foo (const char *x) +{ + const char *a; + long b = 0; + + a = __builtin_strchr (s, '.'); + return ((long) a) + (1 - (long) t); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34030.c b/gcc/testsuite/gcc.c-torture/compile/pr34030.c new file mode 100644 index 000000000..f4f9e176d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34030.c @@ -0,0 +1,8 @@ +int myvar; + +int foo(int mynum) +{ + if ((((void *)0) == (myvar & ((1U<<0) << mynum))) && (mynum > 0)) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34091.c b/gcc/testsuite/gcc.c-torture/compile/pr34091.c new file mode 100644 index 000000000..0b8549132 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34091.c @@ -0,0 +1,175 @@ +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef int GLint; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef GLushort GLchan; +struct gl_texture_image; +typedef struct __GLcontextRec GLcontext; +typedef void (*FetchTexelFuncC) (const struct gl_texture_image * texImage, + GLint col, GLint row, GLint img, + GLchan * texelOut); +struct gl_texture_format +{ +}; +struct gl_texture_image +{ + GLenum _BaseFormat; + GLboolean _IsPowerOfTwo; + FetchTexelFuncC FetchTexelc; +}; +struct gl_texture_object +{ + GLenum Target; + GLenum WrapS; + GLenum MinFilter; + GLenum MagFilter; + GLint BaseLevel; + GLint _MaxLevel; + struct gl_texture_image *Image[6][12]; +}; +enum _format +{ + MESA_FORMAT_RGBA_DXT3, MESA_FORMAT_RGBA_DXT5, MESA_FORMAT_RGBA, + MESA_FORMAT_RGB, MESA_FORMAT_ALPHA, MESA_FORMAT_LUMINANCE, +}; +typedef void (*texture_sample_func) (GLcontext * ctx, + const struct gl_texture_object * tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], + GLchan rgba[][4]); +lerp_2d (GLfloat a, GLfloat b, GLfloat v00, GLfloat v10, GLfloat v01, + GLfloat v11) +{ + const GLfloat temp0 = ((v00) + (a) * ((v10) - (v00))); + const GLfloat temp1 = ((v01) + (a) * ((v11) - (v01))); + return ((temp0) + (b) * ((temp1) - (temp0))); +} +static __inline__ void +lerp_rgba (GLchan result[4], GLfloat t, const GLchan a[4], const GLchan b[4]) +{ + result[0] = (GLchan) (((a[0]) + (t) * ((b[0]) - (a[0]))) + 0.5); + result[1] = (GLchan) (((a[1]) + (t) * ((b[1]) - (a[1]))) + 0.5); + result[2] = (GLchan) (((a[2]) + (t) * ((b[2]) - (a[2]))) + 0.5); +} +static __inline__ void +lerp_rgba_2d (GLchan result[4], GLfloat a, GLfloat b, const GLchan t00[4], + const GLchan t10[4], const GLchan t01[4], const GLchan t11[4]) +{ + result[0] = (GLchan) (lerp_2d (a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); + result[1] = (GLchan) (lerp_2d (a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); + result[2] = (GLchan) (lerp_2d (a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); +} +static __inline__ void +sample_2d_linear_repeat (GLcontext * ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], GLchan rgba[]) +{ + GLint i0, j0, i1, j1; + GLfloat a, b; + GLchan t00[4], t10[4], t01[4], t11[4]; + { + }; + img->FetchTexelc (img, i1, j1, 0, t11); + lerp_rgba_2d (rgba, a, b, t00, t10, t01, t11); +} +sample_2d_nearest_mipmap_linear (GLcontext * ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + GLint level = linear_mipmap_level (tObj, lambda[i]); + sample_2d_nearest (ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); + GLchan t0[4], t1[4]; + sample_2d_nearest (ctx, tObj, tObj->Image[0][level], texcoord[i], t0); + sample_2d_nearest (ctx, tObj, tObj->Image[0][level + 1], texcoord[i], t1); +} +static void +sample_2d_linear_mipmap_linear_repeat (GLcontext * ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) + { + GLint level = linear_mipmap_level (tObj, lambda[i]); + if (level >= tObj->_MaxLevel) + { + GLchan t0[4], t1[4]; + const GLfloat f = ((lambda[i]) - ifloor (lambda[i])); + sample_2d_linear_repeat (ctx, tObj, tObj->Image[0][level], + texcoord[i], t0); + sample_2d_linear_repeat (ctx, tObj, tObj->Image[0][level + 1], + texcoord[i], t1); + lerp_rgba (rgba[i], f, t0, t1); + } + } +} +static void +sample_lambda_2d (GLcontext * ctx, const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; + GLuint minStart, minEnd; + GLuint magStart, magEnd; + const GLboolean repeatNoBorderPOT = (tObj->WrapS == 0x2901) + && (tImg->_BaseFormat != 0x1900) && tImg->_IsPowerOfTwo; + compute_min_mag_ranges (tObj, n, lambda, &minStart, &minEnd, &magStart, + &magEnd); + if (minStart < minEnd) + { + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) + { + case 0x2600: + if (repeatNoBorderPOT) + { + case MESA_FORMAT_RGB: + opt_sample_rgb_2d (ctx, tObj, m, texcoords + minStart, + ((void *) 0), rgba + minStart); + case MESA_FORMAT_RGBA: + opt_sample_rgba_2d (ctx, tObj, m, texcoords + minStart, + ((void *) 0), rgba + minStart); + } + { + sample_nearest_2d (ctx, tObj, m, texcoords + minStart, + ((void *) 0), rgba + minStart); + } + break; + sample_2d_nearest_mipmap_linear (ctx, tObj, m, texcoords + minStart, + lambda + minStart, + rgba + minStart); + case 0x2703: + if (repeatNoBorderPOT) + sample_2d_linear_mipmap_linear_repeat (ctx, tObj, m, + texcoords + minStart, + lambda + minStart, + rgba + minStart); + } + switch (tObj->MagFilter) + { + case MESA_FORMAT_RGB: + opt_sample_rgb_2d (ctx, tObj, m, texcoords + magStart, + ((void *) 0), rgba + magStart); + opt_sample_rgba_2d (ctx, tObj, m, texcoords + magStart, + ((void *) 0), rgba + magStart); + sample_nearest_2d (ctx, tObj, m, texcoords + magStart, + ((void *) 0), rgba + magStart); + } + } +} +texture_sample_func +_swrast_choose_texture_sample_func (const struct gl_texture_object *t) +{ + switch (t->Target) + { + case 0x0DE0: + return &sample_lambda_2d; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34093.c b/gcc/testsuite/gcc.c-torture/compile/pr34093.c new file mode 100644 index 000000000..4f6934380 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34093.c @@ -0,0 +1,39 @@ +struct X { int i; int j; }; +#define FOO struct X +#define FOO10(x) FOO x ## 0; FOO x ## 1; FOO x ## 2; FOO x ## 3; FOO x ## 4; FOO x ## 5; FOO x ## 6; FOO x ## 7; FOO x ## 8; FOO x ## 9; +#define FOO100(x) FOO10(x ## 0) FOO10(x ## 1) FOO10(x ## 2) FOO10(x ## 3) FOO10(x ## 4) FOO10(x ## 5) FOO10(x ## 6) FOO10(x ## 7) FOO10(x ## 8) FOO10(x ## 9) + FOO100(x0) + FOO100(x1) + FOO100(x2) + FOO100(x3) + FOO100(x4) + FOO100(x5) + FOO100(x6) + FOO100(x7) + FOO100(x8) + FOO100(x9) + +#define COO(n,f) case n: p = &f; break; +#define COO10(n,f) COO(n ## 0, f ## 0) COO(n ## 1, f ## 1) COO(n ## 2, f ## 2) COO(n ## 3, f ## 3) COO(n ## 4, f ## 4) COO(n ## 5, f ## 5) COO(n ## 6, f ## 6) COO(n ## 7, f ## 7) COO(n ## 8, f ## 8) COO(n ## 9, f ## 9) +#define COO100(n,f) COO10(n ## 0, f ## 0) COO10(n ## 1, f ## 1) COO10(n ## 2, f ## 2) COO10(n ## 3, f ## 3) COO10(n ## 4, f ## 4) COO10(n ## 5, f ## 5) COO10(n ## 6, f ## 6) COO10(n ## 7, f ## 7) COO10(n ## 8, f ## 8) COO10(n ## 9, f ## 9) + +int foo(int i) +{ + struct X *p = 0; + x000.i = 0; + x599.j = 0; + switch (i) + { + COO100(1, x0) + COO100(2, x1) + COO100(3, x2) + COO100(4, x3) + COO100(5, x4) + COO100(6, x5) + COO100(7, x6) + COO100(8, x7) + COO100(9, x8) + COO100(10, x9) + } + return p->j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34113.c b/gcc/testsuite/gcc.c-torture/compile/pr34113.c new file mode 100644 index 000000000..7694b8260 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34113.c @@ -0,0 +1,11 @@ +struct sockaddr_in { int sin_addr; }; +static void ConvertAddr (struct sockaddr_in *saddr, void **addr) +{ + *addr = (void *) &saddr->sin_addr; +} +unsigned char EnableLocalHost (struct sockaddr_in *ifa_addr) +{ + unsigned char * addr; + ConvertAddr(ifa_addr, (void **)&addr); + return addr[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34127.c b/gcc/testsuite/gcc.c-torture/compile/pr34127.c new file mode 100644 index 000000000..10d41acaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34127.c @@ -0,0 +1,9 @@ +static void +whichtable(char **pfmt) +{ + --*pfmt; +} +void prepare_s(const char *fmt) +{ + whichtable((char **)&fmt); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34138.c b/gcc/testsuite/gcc.c-torture/compile/pr34138.c new file mode 100644 index 000000000..85e8863cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34138.c @@ -0,0 +1,21 @@ +extern void free (void *__ptr); +struct shparam +{ + char **p; + int foo; +}; +static struct shparam shellparam; +inline void freeparam (volatile struct shparam *param, char **ap) +{ + free ((void *) (*ap)); + free ((void *) (param->p)); +} +void dotcmd (char **p) +{ + freeparam (&shellparam, p); +} +void evaltree (void) +{ + void (*evalfn) (char **); + evalfn = dotcmd; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34334.c b/gcc/testsuite/gcc.c-torture/compile/pr34334.c new file mode 100644 index 000000000..30bb78262 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34334.c @@ -0,0 +1,140 @@ +__extension__ typedef __SIZE_TYPE__ size_t; +__extension__ typedef long long int __quad_t; +__extension__ typedef unsigned int __mode_t; +__extension__ typedef __quad_t __off64_t; +typedef __mode_t mode_t; +typedef __off64_t off_t; +struct timeval {}; +typedef struct {} fd_set; +typedef union {} __pthread_slist_t; +typedef union { + struct __pthread_mutex_s { __extension__ union { }; } __data; +}; +extern int stat64 (__const char *__restrict __file, struct stat64 *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); +extern int fstatat64 (int __fd, __const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3))); +enum __socket_type { SOCK_STREAM = 1, }; +enum { SI_ASYNCNL = -60, }; +enum { CLD_EXITED = 1, }; +typedef struct sigaltstack { } stack_t; +enum __rlimit_resource { __RLIMIT_SIGPENDING = 11, }; +struct rlimit { }; +enum __priority_which { PRIO_PROCESS = 0, }; +typedef union { } __WAIT_STATUS __attribute__ ((__transparent_union__)); +union wait { + struct { } __wait_stopped; +}; +typedef enum { P_ALL, } idtype_t; +struct utsname { }; +enum { IPPROTO_IP = 0, }; +enum { IPPORT_ECHO = 7, }; +struct in_addr { }; +struct in6_addr { + union { } in6_u; +}; +typedef long int wchar_t; +typedef unsigned char guint8; +typedef signed int gint32; +typedef unsigned int guint32; +typedef signed int gssize; +typedef unsigned int gsize; +struct _GStaticMutex { + union { } static_mutex; +}; +union _GSystemThread { }; +typedef int GPid; +typedef char gchar; +typedef int gint; +typedef gint gboolean; +typedef unsigned short gushort; +typedef unsigned long gulong; +typedef unsigned int guint; +typedef void* gpointer; +typedef const void *gconstpointer; +typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b); +typedef void (*GFunc) (gpointer data, gpointer user_data); +typedef void (*GHFunc) (gpointer key, gpointer user_data); +struct _GTimeVal { }; +typedef struct _GByteArray GByteArray; +guint8* g_byte_array_free (GByteArray *array, guint index_); +typedef guint32 GQuark; +typedef struct _GError GError; +GError* g_error_new (GQuark domain, const gchar *message); +gboolean g_error_matches (const GError *error, gint code); +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; +typedef enum { G_USER_DIRECTORY_DESKTOP, } GUserDirectory; +typedef enum { G_THREAD_PRIORITY_URGENT } GThreadPriority; +struct _GThread { }; +typedef struct _GCond GCond; +struct _GThreadFunctions { + void (*cond_wait) (GCond *cond, GError **error); + gboolean (*thread_equal) (gpointer thread1, gpointer thread2); +}; +typedef struct _GAsyncQueue GAsyncQueue; +void g_async_queue_sort (GAsyncQueue *queue, guint *save); +struct tm { }; +typedef struct __locale_struct { } *__locale_t; +extern int getaddrinfo (__const char *__restrict __name, struct addrinfo **__restrict __pai); +typedef struct _IO_FILE FILE; +__strsep_1c (char **__s, char __reject) { } +__strsep_2c (char **__s, char __reject1, char __reject2) { } +typedef struct stack_st { } STACK; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct EDIPartyName_st { + union { } d; +} GENERAL_NAME; +typedef struct DIST_POINT_NAME_st { + union { } name; +} DIST_POINT_NAME; +typedef struct SXNET_st { } NOTICEREF; +typedef struct GENERAL_SUBTREE_st { } X509_PURPOSE; +int X509V3_add_value(const char *name, const char *value, STACK **extlist); +int X509_PURPOSE_add(int id, int trust, int flags, char *name, char *sname, void *arg); +extern char *dcgettext (__const char *__domainname, __const char *__msgid, int __category) __attribute__ ((__nothrow__)) __attribute__ ((__format_arg__ (2))); +enum { __LC_CTYPE = 0, }; +struct lconv { }; +typedef enum gftp_logging_level_tag { gftp_logging_send, } gftp_logging_level; +struct gftp_file_tag { + char *file, *destfile; + unsigned int selected : 1, + is_fd : 1; + gint32 ipv4_network_address, ipv4_netmask; +} gftp_proxy_hosts; +typedef enum { gftp_option_type_text = 0, } gftp_option_type_enum; +typedef struct gftp_config_list_vars_tag { } gftp_config_list_vars; +typedef struct gftp_config_vars_tag { } gftp_config_vars; +typedef struct gftp_option_type_tag { + int (*read_function) (char *str, gftp_config_vars * cv, int line); + int (*write_function) (gftp_config_vars * cv, char *buf, size_t buflen, int to_config_file); +} gftp_option_type_var; +typedef struct gftp_request_tag gftp_request; +typedef void (*gftp_logging_func) ( gftp_logging_level level, const char *string, ... ); +typedef struct gftp_transfer_tag { + gftp_request * fromreq, * toreq; + unsigned int cancel : 1, + skip_file : 1; + long numfiles, resumed_bytes; +} gftp_transfer; +typedef struct gftp_log_tag { + unsigned int shown : 1, + use_threads : 1; +} supported_gftp_protocols; +void +gftp_config_parse_args (char *str, int numargs, int lineno, char **first, ...) +{ + char *curpos, *endpos, *pos, **dest, tempchar; + va_list argp; + dest = first; + while (numargs > 0) + { + if (numargs > 1) + { + dest = __builtin_va_arg(argp,char **); + *dest = ((void *)0); + } + numargs--; + **dest = '\0'; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34448.c b/gcc/testsuite/gcc.c-torture/compile/pr34448.c new file mode 100644 index 000000000..625f6f8cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34448.c @@ -0,0 +1,31 @@ +typedef struct chunk_t chunk_t; +struct chunk_t +{ + unsigned char *ptr; + long unsigned int len; +}; +extern chunk_t asn1_wrap (chunk_t c, ...); +typedef struct linked_list_t linked_list_t; +chunk_t ietfAttr_list_encode (linked_list_t * list); +extern linked_list_t *groups; +static unsigned char ASN1_group_oid_str[] = { + 0x06 +}; +static const chunk_t ASN1_group_oid = { + ASN1_group_oid_str, sizeof (ASN1_group_oid_str) +}; +static chunk_t +build_attribute_type (const chunk_t type, chunk_t content) +{ + return type; +} +static chunk_t +build_attributes (void) +{ + return asn1_wrap (build_attribute_type (ASN1_group_oid, + ietfAttr_list_encode (groups))); +} +void build_attr_cert (void) +{ + asn1_wrap (build_attributes ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34458.c b/gcc/testsuite/gcc.c-torture/compile/pr34458.c new file mode 100644 index 000000000..096cc0c9b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34458.c @@ -0,0 +1,16 @@ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +typedef struct +{ + int data[1024]; +} +Lint; +Lint lint_operate (Lint a, long long ammount) +{ + int index; + Lint ret; + for (index = 0; index < 24; index++) + ret.data[index] = + a.data[index + ammount / 32 + 1] << a.data[index + ammount / 32]; + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34648.c b/gcc/testsuite/gcc.c-torture/compile/pr34648.c new file mode 100644 index 000000000..8bcdae050 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34648.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/34648 */ + +/* { dg-options "-fexceptions" } */ + +extern const unsigned short int **bar (void) __attribute__ ((const)); +const char *a; +int b; +char c; + +char +foo (int *x) +{ + char r; + + c = '\0'; + if (!b) + { + while (((*bar ())[a[*x]] & 0x2000) != 0) + (*x)++; + if (a[++(*x)] == '-') + { + (*x)++; + if (a[*x] && !((*bar ())[a[*x]] & 0x2000)) + return '?'; + } + if (!a[*x] || ((*bar ())[a[*x]] & 0x2000)) + { + while (((*bar ())[a[*x]] & 0x2000)) + ++(*x); + return '\0'; + } + } + + r = a[*x]; + b = a[*x] && !((*bar ())[a[*x]] & 0x2000); + return r; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34688.c b/gcc/testsuite/gcc.c-torture/compile/pr34688.c new file mode 100644 index 000000000..60e0f3c9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34688.c @@ -0,0 +1,147 @@ +typedef __SIZE_TYPE__ size_t; + typedef struct { + } + HashTable; + typedef struct _zval_struct zval; + typedef struct _zend_guard { + HashTable *ht; + } + zvalue_value; + struct _zval_struct { + zvalue_value value; + } + php_output_globals; + typedef struct _php_stream php_stream; + typedef struct _php_stream_filter php_stream_filter; + typedef struct _php_stream_bucket_brigade php_stream_bucket_brigade; + typedef enum { + PSFS_ERR_FATAL, PSFS_FEED_ME, PSFS_PASS_ON, } + php_stream_filter_status_t; + typedef struct _php_stream_filter_ops { + php_stream_filter_status_t (*filter)( php_stream *stream, php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags ); + void (*dtor)(php_stream_filter *thisfilter ); + const char *label; + } + php_stream_filter_ops; + struct _php_stream_filter { + }; + typedef struct _php_stream_filter_factory { + php_stream_filter *(*create_filter)(const char *filtername, zval *filterparams, int persistent ); + } + php_stream_filter_factory; + typedef enum _php_conv_err_t { + PHP_CONV_ERR_SUCCESS = 0, PHP_CONV_ERR_UNKNOWN, PHP_CONV_ERR_TOO_BIG, PHP_CONV_ERR_INVALID_SEQ, PHP_CONV_ERR_UNEXPECTED_EOS, PHP_CONV_ERR_EXISTS, PHP_CONV_ERR_MORE, PHP_CONV_ERR_ALLOC, PHP_CONV_ERR_NOT_FOUND } + php_conv_err_t; + typedef struct _php_conv php_conv; + typedef php_conv_err_t (*php_conv_convert_func)(php_conv *, const char **, size_t *, char **, size_t *); + struct _php_conv { + php_conv_convert_func convert_op; + } + php_conv_base64_decode; + typedef struct _php_conv_qprint_decode { + php_conv _super; + const char *lbchars; + } + php_conv_qprint_decode; + static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) { + size_t icnt, ocnt; + unsigned char *ps, *pd; + unsigned int scan_stat; + unsigned int lb_ptr, lb_cnt; + for (; + ; + ) { + switch (scan_stat) { + case 0: { + if (*ps == '=') { + scan_stat = 1; + } + else { + if (ocnt < 1) { + goto out; + } + *(pd++) = *ps; + ocnt--; + } + } + break; + case 1: { + if (*ps == ' ' || *ps == '\t') { + } + else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { + lb_cnt++; + scan_stat = 5; + break; + } + else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { + scan_stat = 0; + break; + } + } + case 2: { + if (icnt <= 0) { + goto out; + } + } + case 3: { + } + case 4: { + ps++, icnt--; + } + } + } + out: *in_pp = (const char *)ps; + } + static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent) { + inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert; + } + typedef struct _php_convert_filter { + php_conv *cd; + } + php_convert_filter; + static php_conv *php_conv_open(int conv_mode, const HashTable *options, int persistent) { + php_conv *retval = ((void *)0); + switch (conv_mode) { + case 4: { + char *lbchars = ((void *)0); + size_t lbchars_len; + if (lbchars != ((void *)0)) { + if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, lbchars, lbchars_len, 1, persistent)) { + } + } + } + } + } + static int php_convert_filter_ctor(php_convert_filter *inst, int conv_mode, HashTable *conv_opts, const char *filtername, int persistent) { + if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == ((void *)0)) { + } + } + static php_stream_filter_status_t strfilter_convert_filter( php_stream *stream, php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags ) { + } + static void strfilter_convert_dtor(php_stream_filter *thisfilter ) { + } + static php_stream_filter_ops strfilter_convert_ops = { + strfilter_convert_filter, strfilter_convert_dtor, "convert.*" }; + static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, int persistent ) { + php_convert_filter *inst; + int conv_mode = 0; + if (php_convert_filter_ctor(inst, conv_mode, (filterparams != ((void *)0) ? (*filterparams).value.ht : ((void *)0)), filtername, persistent) != 0) { + } + } + static php_stream_filter_factory strfilter_convert_factory = { + strfilter_convert_create }; + static const struct { + php_stream_filter_ops *ops; + php_stream_filter_factory *factory; + } + standard_filters[] = { + { + &strfilter_convert_ops, &strfilter_convert_factory } + }; + int zm_startup_standard_filters(int type, int module_number ) { + int i; + for (i = 0; + standard_filters[i].ops; + i++) { + } + } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34808.c b/gcc/testsuite/gcc.c-torture/compile/pr34808.c new file mode 100644 index 000000000..8224061e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34808.c @@ -0,0 +1,29 @@ +/* PR 34808 */ +/* { dg-do compile } +/* { dg-options "-fno-tree-dominator-opts" } */ + +extern int flags; + +struct r { int code; int val;}; + +int +foo (struct r *home) +{ + int n = 0; + int regno = -1; + + if (home->code == 0) + regno = home->val; + + if (home->code == 1) + bar (); + else if (regno >= 0) + n = (regno == 16 + ? 16 + : (regno - (unsigned long long) (flags != 0 ? 63 : 15) + ? regno - 128 + : -1)); + + baz (); + return n; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34856.c b/gcc/testsuite/gcc.c-torture/compile/pr34856.c new file mode 100644 index 000000000..7b0d5962a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34856.c @@ -0,0 +1,18 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +#undef __vector +#define __vector __attribute__((vector_size(16) )) +typedef __vector signed char qword; +typedef __vector unsigned int VU32; +extern short g[192 +16]; +void f(qword); +void f1 (unsigned ctr) +{ + VU32 pin; + pin = (VU32){(__SIZE_TYPE__)&g[16]}; + do { + f((qword)pin); + ctr--; + } +while(ctr); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34885.c b/gcc/testsuite/gcc.c-torture/compile/pr34885.c new file mode 100644 index 000000000..f5a3c13b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34885.c @@ -0,0 +1,14 @@ +typedef union { + __const struct sockaddr *__restrict __sockaddr__; +} __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__)); +extern int _pure_socketcall (const struct sockaddr *); +extern int sendto (__CONST_SOCKADDR_ARG __addr); +int send(void) +{ + return sendto((void *)0); +} +int sendto(const struct sockaddr *to) +{ + return _pure_socketcall(to); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34966.c b/gcc/testsuite/gcc.c-torture/compile/pr34966.c new file mode 100644 index 000000000..6c36fb1e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34966.c @@ -0,0 +1,21 @@ +extern double sin (double), cos (double); + +__inline double +atan (double __x) +{ + register double __result; +#if defined(__i386__) || defined(__x86_64__) + __asm __volatile__ ("" : "=t" (__result) : "0" (__x)); +#else + __result = __x; +#endif + return __result; +} + +double +f(double x) +{ + double t = atan (x); + return cos (t) + sin (t); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34993.c b/gcc/testsuite/gcc.c-torture/compile/pr34993.c new file mode 100644 index 000000000..ced4d5646 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34993.c @@ -0,0 +1,5 @@ +/* PR c/34993 */ + +/* { dg-do compile } */ + +typedef int x[] __attribute((may_alias)); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35006.c b/gcc/testsuite/gcc.c-torture/compile/pr35006.c new file mode 100644 index 000000000..53de05cdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35006.c @@ -0,0 +1,29 @@ +typedef unsigned long grub_uint64_t; +typedef grub_uint64_t grub_size_t; +grub_cmdline_get (unsigned max_len, int echo_char) +{ + unsigned xpos, ypos, ystart; + grub_size_t lpos, llen; + char buf[max_len]; + void cl_print (int pos, int c) + { + char *p; + for (p = buf + pos; *p; p++) + { + if (xpos++ > 78) + grub_putchar ('\n'); + grub_putchar (*p); + } + } + void cl_delete (unsigned len) + { + cl_set_pos (); + cl_print (lpos, ' '); + grub_memmove (); + cl_print (lpos, echo_char); + cl_set_pos (); + } + cl_delete (llen); + grub_size_t n = lpos; + cl_delete (n); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35043.c b/gcc/testsuite/gcc.c-torture/compile/pr35043.c new file mode 100644 index 000000000..a14379dc1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35043.c @@ -0,0 +1,20 @@ +typedef __SIZE_TYPE__ size_t; +typedef struct { + long double dat[2]; +} gsl_complex_long_double; +typedef struct { + size_t size; + size_t stride; + long double *data; +} gsl_vector_complex_long_double; +void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v) +{ + long double * const data = v->data; + const size_t n = v->size; + const size_t stride = v->stride; + const gsl_complex_long_double zero = { { 0.0L,0.0L} } ; + size_t i; + for (i = 0; i < n; i++) + *(gsl_complex_long_double *) (data + 2 * i * stride) = zero; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35171.c b/gcc/testsuite/gcc.c-torture/compile/pr35171.c new file mode 100644 index 000000000..3f7ef2cca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35171.c @@ -0,0 +1,10 @@ +int f(int a, int b, short c, int d, short e)
+{
+ int i;
+ for (i = 1; i <= 2 ; i++) {
+ c -= 4;
+ a = c;
+ d = d + (b?b:e);
+ }
+ return a + d;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35318.c b/gcc/testsuite/gcc.c-torture/compile/pr35318.c new file mode 100644 index 000000000..6837d2d83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35318.c @@ -0,0 +1,9 @@ +/* { dg-skip-if "" { pdp11-*-* } { "*" } { "" } } */ +/* PR target/35318 */ + +void +foo () +{ + double x = 4, y; + __asm__ volatile ("" : "=r,r" (x), "=r,r" (y) : "%0,0" (x), "m,r" (8)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35431.c b/gcc/testsuite/gcc.c-torture/compile/pr35431.c new file mode 100644 index 000000000..ffe9d068a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35431.c @@ -0,0 +1,15 @@ +void bar(); + +void foo(int i) +{ + __complex__ int k = 0; + + if (i) + k = 1; + + for (i = 0; i < 1; ++i) + ; + + if (k) + bar(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35432.c b/gcc/testsuite/gcc.c-torture/compile/pr35432.c new file mode 100644 index 000000000..6a0c92177 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35432.c @@ -0,0 +1,11 @@ +/* PR middle-end/35432 */ + +struct A +{ + char c[0]; +}; + +void foo(struct A a) +{ + (a = a).c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35468.c b/gcc/testsuite/gcc.c-torture/compile/pr35468.c new file mode 100644 index 000000000..16d064b62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35468.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/35468 */ + +void +foo (void) +{ + *(char *) "c" = 'x'; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35492.c b/gcc/testsuite/gcc.c-torture/compile/pr35492.c new file mode 100644 index 000000000..a1681f0a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35492.c @@ -0,0 +1,26 @@ +void prepare_to_wait (void *, void *, int); +void finish_wait (void *, void *); +extern signed long schedule_timeout (signed long); +struct sock +{ + unsigned char skc_state; + void *sk_sleep; + int sk_err; +}; + +void +sk_stream_wait_connect (struct sock *sk, long *timeo_p) +{ + int done; + int wait; + do + { + if ((1 << sk->skc_state) & ~12) + return; + prepare_to_wait (sk->sk_sleep, &wait, 1); + *(timeo_p) = schedule_timeout (0); + done = !sk->sk_err; + finish_wait (sk->sk_sleep, &wait); + } + while (!done); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35595.c b/gcc/testsuite/gcc.c-torture/compile/pr35595.c new file mode 100644 index 000000000..d88cedc56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35595.c @@ -0,0 +1,59 @@ +/* { dg-require-effective-target int32plus } */ +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +typedef union +{ + float value; + __uint32_t word; +} +ieee_float_shape_type; +static const float two23 = 8.3886080000e+06; +static const float pi = 3.1415927410e+00; +static const float zero = 0.0000000000e+00; +static float +sin_pif (float x) +{ + float y = 0; + float z = 0; + __int32_t n = 0; + __int32_t ix = 0; + do + { + ieee_float_shape_type gf_u = { 0 }; + (ix) = gf_u.word; + } + while (0); + if (z == y) + { + if (ix < 0x4b800000) + { + if (ix < 0x4b000000) + z = y + two23; + do + { + ieee_float_shape_type gf_u; + gf_u.value = (z); + (n) = gf_u.word; + } + while (0); + } + } + if (n == 0) + y = __kernel_sinf (pi * y, zero, 0); +} + +float +__ieee754_lgammaf_r (float x, int *signgamp) +{ + float t = 0; + __int32_t hx = 0; + do + { + ieee_float_shape_type gf_u = { 0 }; + (hx) = gf_u.word; + } + while (0); + if (hx < 0) + t = sin_pif (x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35607.c b/gcc/testsuite/gcc.c-torture/compile/pr35607.c new file mode 100644 index 000000000..7f5aa7a2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35607.c @@ -0,0 +1,9 @@ +extern void (*__fini_array_start []) (void); +extern void (*__fini_array_end []) (void); +void +__libc_csu_fini (void) +{ + __SIZE_TYPE__ i = __fini_array_end - __fini_array_start; + while (i-- > 0) + (*__fini_array_start [i]) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35760.c b/gcc/testsuite/gcc.c-torture/compile/pr35760.c new file mode 100644 index 000000000..9b972f6b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35760.c @@ -0,0 +1,7 @@ +/* PR target/35760 */ + +void +foo (void) +{ + __complex__ float i = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35869.c b/gcc/testsuite/gcc.c-torture/compile/pr35869.c new file mode 100644 index 000000000..e83c0e86b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35869.c @@ -0,0 +1,47 @@ +struct texture_stage_op +{ + unsigned int carg1, carg2, carg0; + unsigned int aarg1, aarg2, aarg0; + unsigned int dst; +}; + +static const char *debug_register(unsigned int reg) { + switch(reg) { + case 0x8921: return "GL_REG_0_ATI"; + case 0x8923: return "GL_REG_2_ATI"; + case 0x0: return "GL_ZERO"; + case 0x1: return "GL_ONE"; + default: return "Unknown register\n"; + } +} + +static unsigned int find_tmpreg(struct texture_stage_op op[8]) { + int i; + int tex_used[8]; + + for(i = 0; i < 8; i++) { + if(op[i].carg1 == 0x00000002 ) { + tex_used[i] = 1; + } + } + + for(i = 1; i < 6; i++) { + if(!tex_used[i]) { + return 0x8921 + i; + } + } + return 0; +} + +extern f(const char*); + +void g() { + struct texture_stage_op op[8]; + unsigned int tmparg = find_tmpreg(op); + unsigned int dstreg; + + if(tmparg == 0x0) return; + dstreg = tmparg; + f(debug_register(dstreg)); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36125.c b/gcc/testsuite/gcc.c-torture/compile/pr36125.c new file mode 100644 index 000000000..9257e8468 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36125.c @@ -0,0 +1,10 @@ +/* PR middle-end/36125 */ + +extern void bar (long double *); + +int +foo (long double x) +{ + bar (&x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36141.c b/gcc/testsuite/gcc.c-torture/compile/pr36141.c new file mode 100644 index 000000000..82756199b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36141.c @@ -0,0 +1,17 @@ +extern void ffi_closure_unix (void); +ffi_prep_closure_loc (void) +{ + struct ia64_fd + { + unsigned long long code_pointer; + unsigned long long gp; + }; + struct ffi_ia64_trampoline_struct + { + unsigned long long code_pointer; + }; + struct ffi_ia64_trampoline_struct *tramp; + struct ia64_fd *fd; + fd = (struct ia64_fd *)(void *)ffi_closure_unix; + tramp->code_pointer = fd->code_pointer; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36154.c b/gcc/testsuite/gcc.c-torture/compile/pr36154.c new file mode 100644 index 000000000..ae3eb83fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36154.c @@ -0,0 +1,11 @@ +struct eth_test_pkt { + unsigned short len; + unsigned short ctr; + unsigned char packet[]; +} __attribute__ ((packed)); +struct eth_test_pkt pkt_unaligned = { .packet = { 0xFC } }; +int cmd_unaligned(const void *p) +{ + return memcmp(p, pkt_unaligned.packet, 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36172.c b/gcc/testsuite/gcc.c-torture/compile/pr36172.c new file mode 100644 index 000000000..aaee377f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36172.c @@ -0,0 +1,17 @@ +int f(float * ); +__SIZE_TYPE__ FcCharSetFreeze (int *fcs, int b) +{ + int i; + int a = 0; + for (i = 0; i < *fcs; i++) + { + float *leaf = (float *)fcs; + int hash = f (leaf); + if (hash) + a = b; + if (!a) + return; + } + return (__SIZE_TYPE__) fcs; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36238.c b/gcc/testsuite/gcc.c-torture/compile/pr36238.c new file mode 100644 index 000000000..358e1ff5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36238.c @@ -0,0 +1,27 @@ +typedef signed char int8_t; +typedef int int32_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +int32_t g_19 = 0x67F5AEE0L; +uint16_t g_169 = 0x89E3L; +const volatile uint32_t g_258 = 0x63AFEBCAL; +int32_t func_11; +int32_t func_29; +int32_t +func_5 (int32_t p_6, int32_t p_8, uint16_t p_10) +{ + if (lshift_s_s (func_11, p_8)) + { + int8_t l_18 = 0x6FL; + if (l_18) + for (p_6 = -14;; g_19 += 6) + { + int32_t l_283 = -1L; + if (((0x45L / 1L) > 0x07414511L * 1L / 1L > func_29) / 1L) + for (p_8 = 6;; p_8 -= 5) + l_283 = 0xC90541F7L; + } + } + else + g_169 = g_258; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36245.c b/gcc/testsuite/gcc.c-torture/compile/pr36245.c new file mode 100644 index 000000000..375987539 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36245.c @@ -0,0 +1,21 @@ +extern char buf1[10]; +extern char buf2[10]; +extern void b(int i, int j, int w); + +void a() { + int i,j; + char *p; + int w; + + p = buf1; + for(j = 0;j < 10; j++) { + for(i = 0;i < 10; i++) { + w = *p; + if(w != 1) { + w = buf2[p - buf1]; + b(i*2+1, j, w); + } + p++; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36666.c b/gcc/testsuite/gcc.c-torture/compile/pr36666.c new file mode 100644 index 000000000..9eb132cd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36666.c @@ -0,0 +1,22 @@ +struct Foo { + int *p; + struct X { + int a,b,c,d,e,*f; + } x; +} *init, *init2; + +struct X __attribute__((const)) foo(struct X); +struct Foo __attribute__((const)) foo2(struct Foo); + +void bar1 (void) +{ + init->x = foo (init2->x); +} +void bar2 (void) +{ + init->x = foo (init->x); +} +void bar3 (void) +{ + *init = foo2 (*init2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36817.c b/gcc/testsuite/gcc.c-torture/compile/pr36817.c new file mode 100644 index 000000000..396f491ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36817.c @@ -0,0 +1,10 @@ +void xxx() +{ + unsigned i; + unsigned *p=0; + for(i=0; i<4; ++i) + *p++=0; + for(i=0; i<4; ++i) + *p++=0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36988.c b/gcc/testsuite/gcc.c-torture/compile/pr36988.c new file mode 100644 index 000000000..44118d5dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36988.c @@ -0,0 +1,11 @@ +typedef struct { + unsigned char mbxCommand; +} MAILBOX_t; +void lpfc_sli_brdrestart(void) +{ + volatile unsigned int word0; + MAILBOX_t *mb; + mb = (MAILBOX_t *) &word0; + mb->mbxCommand = 0x1A; + __writel((*(unsigned int *) mb)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37026.c b/gcc/testsuite/gcc.c-torture/compile/pr37026.c new file mode 100644 index 000000000..694e2ca2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37026.c @@ -0,0 +1,12 @@ +struct a { + long a1; + long a2; +}; +struct b { + struct a b1; + struct a b2; +}; +void bar (struct b *c) +{ + c->b1 = c->b2 = ((struct a) { foo(), 0 }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37056.c b/gcc/testsuite/gcc.c-torture/compile/pr37056.c new file mode 100644 index 000000000..f9285e2c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37056.c @@ -0,0 +1,28 @@ +extern void abort (void); + +static union { + char buf[12 * sizeof (long long)]; +} u; + +int main () +{ + int off, len, i; + char *p, *q; + + for (off = 0; off < (sizeof (long long)); off++) + for (len = 1; len < (10 * sizeof (long long)); len++) + { + for (i = 0; i < (12 * sizeof (long long)); i++) + u.buf[i] = 'a'; + p = (__extension__ (__builtin_constant_p ('\0') && ('\0') == '\0' + ? ({void *__s = (u.buf + off); __s;}) + : __builtin_memset (u.buf + off, '\0', len))); + if (p != u.buf + off) + abort (); + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37078.c b/gcc/testsuite/gcc.c-torture/compile/pr37078.c new file mode 100644 index 000000000..1cc1659f1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37078.c @@ -0,0 +1,6 @@ +int foo (int b) +{ + if (b == (int)0x80000000) + return __builtin_abs (b); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37207.c b/gcc/testsuite/gcc.c-torture/compile/pr37207.c new file mode 100644 index 000000000..72333d26f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37207.c @@ -0,0 +1,21 @@ +void +func_18 ( int t ) +{ + unsigned l_889; + int l_895 = 1; + for (0; 1; ++l_889) + { + int t1 = 0; + if (func_81 (1)) + { + int rhs = l_895; + if (rhs == 0) + rhs = 1; + if (1 & (t % rhs)) + t1 = 1; + } + func_98 (t1); + l_895 = 0; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37258.c b/gcc/testsuite/gcc.c-torture/compile/pr37258.c new file mode 100644 index 000000000..5091d980b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37258.c @@ -0,0 +1,58 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +__extension__ typedef long long int int64_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +static inline unsigned int +lshift_u_s (unsigned int left, int right) +{ + if ((right) || (right >= sizeof (unsigned int) * 8) + || (left > (4294967295U >> right))) + return left; +} +static inline unsigned long int +div_rhs (long int rhs) +{ + if (rhs == 0) + return 1; + return rhs; +} + +uint32_t g_230; +int8_t g_294; +uint16_t g_316; +uint32_t g_334; +int32_t g_375; +int64_t g_380; +int32_t func_99 (int16_t p_100, int32_t p_101, int32_t p_102, int32_t p_103, + int64_t p_105, int32_t p_106, int32_t p_107, int16_t p_108, + int16_t p_109); +int32_t +func_77 (int64_t p_79) +{ + int16_t l_397; + if (mod_rhs (p_79)) + p_79 = 1; + else + for (p_79 = 0; 0; p_79 += 1) + { + } + if (lshift_s_s (1, func_112 (2L, (lshift_u_s (g_334, p_79))))) + { + int8_t l_384; + int64_t l_414; + if (lshift_u_s (g_375, 1)) + { + func_23 (func_99 (1, 1, 1, 1, g_230, p_79, 1, g_334, 1), 1); + for (p_79 = 0; 0; ++p_79) + { + } + } + if (div_rhs (func_82 (1, 1, g_380, 1, l_397, 1, 1))) + func_99 ((func_82 + (1, g_334, g_294, func_112 (1, (p_79 & 1)), g_316, 1, 1)), + 1, (0xFBA25CA382A8CA74LL), l_384, l_414, 0L, 1, 1, 1); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37285.c b/gcc/testsuite/gcc.c-torture/compile/pr37285.c new file mode 100644 index 000000000..972478b18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37285.c @@ -0,0 +1,15 @@ +_bfd_xcoff_canonicalize_dynamic_reloc (unsigned long long l_symndx) +{ + if (l_symndx < 3) + { + switch (l_symndx) + { + case 0: + case 1: + break; + case 2: + _bfd_abort ("HI"); + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37305.c b/gcc/testsuite/gcc.c-torture/compile/pr37305.c new file mode 100644 index 000000000..7c0673609 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37305.c @@ -0,0 +1,19 @@ +typedef int int32_t; +typedef unsigned int uint32_t; +static inline int +safe_add_s_s (int si1, int si2) +{ + if ((si1 > 0) && (si2 > 0) && (si1 > (si2)) || (si1 < 0) && (si2 < 0) + && (si1 < ((-__INT_MAX__ - 1) - si2))) + return si1; +} + +uint32_t g_8; +uint32_t +func_24 (int32_t p_25) +{ + uint32_t l_30 = -1L; + if ((safe_mod_u_u (1, 1)) | (safe_add_s_s (g_8, l_30))) + return 1; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37327.c b/gcc/testsuite/gcc.c-torture/compile/pr37327.c new file mode 100644 index 000000000..7041d834e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37327.c @@ -0,0 +1,48 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +static inline uint32_t +safe_add_int8_t_s_s (int8_t si1, int16_t si2) +{ + if ((si1) && (si2) && (si1 > (1 - si2)) || (si1) && (si2 < 0) + && (si1 < (-128 - si2))) + return si1; + return si1 + si2; +} + +uint32_t g_2; +uint32_t g_113; +uint32_t g_145; +int32_t +func_17 (int32_t p_18, uint32_t p_19, uint32_t p_21) +{ + uint32_t l_23 = -1L; + return l_23; +} + +uint32_t +func_26 (uint16_t p_27) +{ + uint32_t l_424; + if (func_93 (func_59 (safe_add_int8_t_s_s (p_27, 1))), + func_124 (l_424, -7L, 1, g_145, 1, (safe_add_int8_t_s_s (1, 1)), 1), 1, + 1, 1) + func_117 (1, 1, + (safe_add_uint64_t_u_u + (1, (safe_add_int8_t_s_s (1, 0xCDF4BE7A1B7E4629LL)))), 1); + uint32_t l_210; + if (func_17 + ((safe_add_int8_t_s_s (g_2, (0x6C79A83AL | func_17 (1, 1, 1)))), + 0x4C9FL, 1)) + { + uint32_t l_212; + if (safe_mul_int32_t_s_s + ((1, 1, l_212, (1, (safe_add_int8_t_s_s (l_210, 1)), 1, 1)), 1)) + if (func_59 (1, (safe_add_int8_t_s_s (g_113, 1)))) + { + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37341.c b/gcc/testsuite/gcc.c-torture/compile/pr37341.c new file mode 100644 index 000000000..adbf0c7e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37341.c @@ -0,0 +1,35 @@ +/* PR rtl-optimization/37341 */ + +short int a; +int b; + +static inline int +f1 (int x, int y) +{ + if (x < 0 || y < 0 || y >= sizeof (int) * 8 || x > (1 >> y)) + return x; +} + +static inline unsigned int +f2 (int x, int y) +{ + if (y <= 0 && x && y < __INT_MAX__ / x) + return x; + return x * y; +} + +int +f3 (void) +{ + return (signed char) 0xb6; +} + +unsigned int +f4 (unsigned int x) +{ + while (1) + { + if ((f2 (f3 (), (f1 (a, b)))) < x) + return 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37380.c b/gcc/testsuite/gcc.c-torture/compile/pr37380.c new file mode 100644 index 000000000..d757e0245 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37380.c @@ -0,0 +1,51 @@ +typedef struct basic_block_def *basic_block; +typedef struct gimple_seq_node_d *gimple_seq_node; +typedef struct gimple_seq_d *gimple_seq; +typedef struct +{ + gimple_seq_node ptr; + gimple_seq seq; + basic_block bb; +} gimple_stmt_iterator; +typedef void *gimple; +extern void exit(int); +struct gimple_seq_node_d +{ + gimple stmt; + struct gimple_seq_node_d *next; +}; +struct gimple_seq_d +{ +}; +static __inline__ gimple_stmt_iterator +gsi_start (gimple_seq seq) +{ + gimple_stmt_iterator i; + i.seq = seq; + return i; +} +static __inline__ unsigned char +gsi_end_p (gimple_stmt_iterator i) +{ + return i.ptr == ((void *)0); +} +static __inline__ void +gsi_next (gimple_stmt_iterator *i) +{ + i->ptr = i->ptr->next; +} +static __inline__ gimple +gsi_stmt (gimple_stmt_iterator i) +{ + return i.ptr->stmt; +} +void +c_warn_unused_result (gimple_seq seq) +{ + gimple_stmt_iterator i; + for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) + { + gimple g = gsi_stmt (i); + if (!g) exit(0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37381.c b/gcc/testsuite/gcc.c-torture/compile/pr37381.c new file mode 100644 index 000000000..a2fed66c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37381.c @@ -0,0 +1,97 @@ +extern unsigned int __invalid_size_argument_for_IOC; +typedef unsigned int __u32; +struct video_window +{ + __u32 x, y; + __u32 width, height; +}; +typedef unsigned long XID; +typedef XID Window; +typedef struct _XExtData +{ + Window root; +} +Screen; +typedef struct +{ + int border_width; +} +XWindowAttributes; +typedef struct _XDisplay Display; +typedef struct +{ + int default_screen; + Screen *screens; +} + *_XPrivDisplay; +typedef struct +{ + int x, y; +} +XSizeHints; +typedef struct +{ + unsigned short hdisplay; + unsigned short vdisplay; +} +XF86VidModeModeInfo; +Display *display; +int tfd; +int ccapt; +int tml; +int fswidth = 0; +int fsheight = 0; +Window fmwin; +XF86VidModeModeInfo **modelines, *fullscreenmode = ((void *) 0); +struct video_window vswin; +DoFullScreen (void) +{ + int i; + int rx, ry; + Window junkwin; + XSizeHints fmsizehints; + XWindowAttributes fmwinattr; + if (ioctl + (tfd, + (((1U) << (((0 + 8) + 8) + 14)) | ((('v')) << (0 + 8)) | (((8)) << 0) | + (((((sizeof (int) == sizeof (int[1]) + && sizeof (int) < + (1 << 14)) ? sizeof (int) : __invalid_size_argument_for_IOC))) << + ((0 + 8) + 8))), &ccapt) < 0) + { + perror ("ioctl VIDIOCCAPTURE"); + } + if (!XTranslateCoordinates + (display, fmwin, + ((&((_XPrivDisplay) display)-> + screens[(((_XPrivDisplay) display)->default_screen)])->root), + -fmwinattr.border_width, -fmwinattr.border_width, &rx, &ry, &junkwin)) + { + } + vswin.width = fswidth; + vswin.height = fsheight; + vswin.x = fmsizehints.x + rx; + vswin.y = fmsizehints.y + ry; + if (ioctl + (tfd, + (((1U) << (((0 + 8) + 8) + 14)) | ((('v')) << (0 + 8)) | (((8)) << 0) | + (((((sizeof (int) == sizeof (int[1]) + && sizeof (int) < + (1 << 14)) ? sizeof (int) : __invalid_size_argument_for_IOC))) << + ((0 + 8) + 8))), &ccapt) < 0) + { + XF86VidModeGetAllModeLines (display, XDefaultScreen (display), &tml, + &modelines); + { + if ((modelines[i]->hdisplay == fswidth) + && (modelines[i]->vdisplay == fsheight)) + { + fullscreenmode = modelines[i]; + } + } + { + XF86VidModeSetViewPort (display, XDefaultScreen (display), vswin.x, + vswin.y); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37382.c b/gcc/testsuite/gcc.c-torture/compile/pr37382.c new file mode 100644 index 000000000..47525bcf9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37382.c @@ -0,0 +1,16 @@ +/* PR target/37382 */ + +void baz (char *); +int c; + +void +bar (void) +{ + char a[2]; + int *ip = &c; + char *p = a, *q = (char *) &ip; + const char *r = q + 2; + for (; q != r; p++, q++) + *p = *q; + baz (a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37387.c b/gcc/testsuite/gcc.c-torture/compile/pr37387.c new file mode 100644 index 000000000..d338933e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37387.c @@ -0,0 +1,11 @@ +typedef long int Int; +void FuncMakeConsequencesPres (long *objDefs1) +{ + long a = (long)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/pr37395.c b/gcc/testsuite/gcc.c-torture/compile/pr37395.c new file mode 100644 index 000000000..e15b1543f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37395.c @@ -0,0 +1,11 @@ +/* PR target/37395 */ + +int +f (int j) +{ + int i; + asm volatile ("" : "=r"(i)); + if (i >= 0) + j = 0; + return j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c new file mode 100644 index 000000000..dbb1a651d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c @@ -0,0 +1,6 @@ +typedef void ft(int); +void f(int args)__attribute__((noreturn)); +void f2(ft *p __attribute__((noreturn))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c new file mode 100644 index 000000000..dcc003984 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c @@ -0,0 +1,6 @@ +typedef void ft(int); +volatile ft f; +void f2(ft *p __attribute__((noreturn))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c new file mode 100644 index 000000000..5a2c2e81e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c @@ -0,0 +1,6 @@ +typedef void ft(int); +void f(int args)__attribute__((const)); +void f2(ft *p __attribute__((const))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c new file mode 100644 index 000000000..bc8727890 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c @@ -0,0 +1,6 @@ +typedef void ft(int); +const ft f; +void f2(ft *p __attribute__((const))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37432.c b/gcc/testsuite/gcc.c-torture/compile/pr37432.c new file mode 100644 index 000000000..747ec34c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37432.c @@ -0,0 +1,9 @@ +static void print_wkb_byte(unsigned char val) { + print_wkb_bytes((unsigned char *)&val, 1, 1); +} +void InsertMultiPoint(int b) { + char a = 1; + if (b) a = 0; + print_wkb_byte(a); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433.c b/gcc/testsuite/gcc.c-torture/compile/pr37433.c new file mode 100644 index 000000000..0ba117988 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37433.c @@ -0,0 +1,11 @@ +int regex_subst(void) +{ + const void *subst = ""; + return (*(int (*)(int))subst) (0); +} + +int foobar (void) +{ + int x; + return (*(int (*)(void))&x) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37483.c b/gcc/testsuite/gcc.c-torture/compile/pr37483.c new file mode 100644 index 000000000..b09489250 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37483.c @@ -0,0 +1,10 @@ +/* PR target/37483 */ + +unsigned long long +foo (unsigned count, int i) +{ + unsigned long long value; + if (i == 0) + value = (value & 0xFFFFFFFF) >> count; + return value; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37617.c b/gcc/testsuite/gcc.c-torture/compile/pr37617.c new file mode 100644 index 000000000..901b8cabf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37617.c @@ -0,0 +1,19 @@ +typedef union +{ + char *string; + double dval; + float fval; +} yystype; +char *f(void) +{ + yystype tok; + tok.dval = 0; + return (tok.string); +} +char *f1(void) +{ + yystype tok; + tok.fval = 0; + return (tok.string); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37662.c b/gcc/testsuite/gcc.c-torture/compile/pr37662.c new file mode 100644 index 000000000..f6977438e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37662.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/37662 */ + +extern int baz (void); + +static int +foo (void) +{ + return 1; +} + +int +bar (void) +{ + return foo () >= 1 ^ (baz () || 0) || 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37664.c b/gcc/testsuite/gcc.c-torture/compile/pr37664.c new file mode 100644 index 000000000..cf5c83d7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37664.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/37664 */ + +int v; + +int +foo () +{ + int a = 0x8899A862; + int b = 0x8E * a; + int c = (b % b); + if (v > (4294967295U >> c)) + return v; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37669-2.c b/gcc/testsuite/gcc.c-torture/compile/pr37669-2.c new file mode 100644 index 000000000..abeae7a2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37669-2.c @@ -0,0 +1,14 @@ +/* PR middle-end/37669 */ + +#define FMT10 "%d%d%d%d%d%d%d%d%d%d" +#define FMT100 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 +#define FMT1000 FMT100 FMT100 FMT100 FMT100 FMT100 \ + FMT100 FMT100 FMT100 FMT100 FMT100 +#define ARG10 , i, i, i, i, i, i, i, i, i, i +#define ARG100 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 +#define ARG1000 ARG100 ARG100 ARG100 ARG100 ARG100 \ + ARG100 ARG100 ARG100 ARG100 ARG100 +void foo (char *s, int i, int j) +{ + __builtin___snprintf_chk (s, i, 1, j, FMT1000 ARG1000); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37669.c b/gcc/testsuite/gcc.c-torture/compile/pr37669.c new file mode 100644 index 000000000..68e96c621 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37669.c @@ -0,0 +1,35 @@ +/* This testcase used to fail because a miscompiled execute_fold_all_builtins. */ + +typedef __SIZE_TYPE__ size_t; +extern __inline __attribute__ ((__always_inline__)) int __attribute__ +((__nothrow__)) snprintf (char *__restrict __s, size_t __n, __const char +*__restrict __fmt, ...) { + return __builtin___snprintf_chk (__s, __n, 2 - 1, +__builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ()); +} +int n1, n2, n3, n4, f5, f6; +char * BackgroundGetUniqueString(void) +{ + char s[256]; + const char *chmap = +"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; + snprintf(s, sizeof(s), +"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + chmap[(n1 >> 0) & 0x3f], chmap[(n1 >> 6) & 0x3f], + chmap[(n1 >> 12) & 0x3f], chmap[(n1 >> 18) & 0x3f], + chmap[(n1 >> 24) & 0x3f], chmap[(n1 >> 28) & 0x3f], + chmap[(n2 >> 0) & 0x3f], chmap[(n2 >> 6) & 0x3f], + chmap[(n2 >> 12) & 0x3f], chmap[(n2 >> 18) & 0x3f], + chmap[(n2 >> 24) & 0x3f], chmap[(n2 >> 28) & 0x3f], + chmap[(n3 >> 0) & 0x3f], chmap[(n3 >> 6) & 0x3f], + chmap[(n3 >> 12) & 0x3f], chmap[(n3 >> 18) & 0x3f], + chmap[(n3 >> 24) & 0x3f], chmap[(n3 >> 28) & 0x3f], + chmap[(n4 >> 0) & 0x3f], chmap[(n4 >> 6) & 0x3f], + chmap[(n4 >> 12) & 0x3f], chmap[(n4 >> 18) & 0x3f], + chmap[(n4 >> 24) & 0x3f], chmap[(n4 >> 28) & 0x3f], + chmap[(f5 >> 12) & 0x3f], chmap[(f5 >> 18) & 0x3f], + chmap[(f5 >> 24) & 0x3f], chmap[(f5 >> 28) & 0x3f], + chmap[(f6 >> 0) & 0x3f], chmap[(f6 >> 6) & 0x3f] + ); + return __builtin_strdup(s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37713.c b/gcc/testsuite/gcc.c-torture/compile/pr37713.c new file mode 100644 index 000000000..04b4394dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37713.c @@ -0,0 +1,10 @@ +void add_opush(void) +{ + unsigned char formats[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xff }; + void *dtds[sizeof(formats)]; + unsigned int i; + unsigned char dtd = 0x08; + for (i = 0; i < sizeof(formats); i++) + dtds[i] = &dtd; + sdp_seq_alloc(dtds); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c b/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c new file mode 100644 index 000000000..541bd42ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c @@ -0,0 +1,17 @@ +void matmul_i4 (int * __restrict dest_y, + const int * __restrict abase, + const int * __restrict bbase_y, + int count, int xcount, int ycount, int aystride) +{ + int x, y, n; + const int * __restrict abase_n; + int bbase_yn; + for (y = 0; y < ycount; y++) + for (n = 0; n < count; n++) { + abase_n = abase + n*aystride; + bbase_yn = bbase_y[n]; + for (x = 0; x < xcount; x++) + dest_y[x] += abase_n[x] * bbase_yn; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37742.c b/gcc/testsuite/gcc.c-torture/compile/pr37742.c new file mode 100644 index 000000000..4ef00be4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37742.c @@ -0,0 +1,21 @@ +void foo(int* __restrict__ p, int* q, int* p1, int *q1) +{ + int i; + + p = p1; + q = q1; + + for (i = 0; i < 4; ++i) + *++q = *++p + 1; +} + +void bar(int* p, int* __restrict__ q, int* p1, int *q1) +{ + int i; + + p = p1; + q = q1; + + for (i = 0; i < 4; ++i) + *++q = *++p + 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37878.c b/gcc/testsuite/gcc.c-torture/compile/pr37878.c new file mode 100644 index 000000000..aa18e6d32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37878.c @@ -0,0 +1,9 @@ +/* PR target/37878 */ + +double y, z; +void foo (long x) +{ + y = *(double *) ((long *) (x - 1) + 1); + z = *(double *) ((long *) (x - 1) + 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37913.c b/gcc/testsuite/gcc.c-torture/compile/pr37913.c new file mode 100644 index 000000000..98b8f6478 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37913.c @@ -0,0 +1,15 @@ +/* PR middle-end/37913 */ + +void foo (void) __attribute__ ((noreturn)); + +static int __attribute__ ((noreturn)) +bar (void) +{ + foo (); +} + +void +baz (void) +{ + int i = bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37955.c b/gcc/testsuite/gcc.c-torture/compile/pr37955.c new file mode 100644 index 000000000..1ac0246f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37955.c @@ -0,0 +1,19 @@ +typedef struct +{ + enum { NotConnected = 0 } conn_state; + unsigned int conn_hndl; +} AEP_CONNECTION_ENTRY; + +static AEP_CONNECTION_ENTRY aep_app_conn_table[256]; + +void aep_mod_exp (void) +{ + int count; + + for (count = 0; count < 256; count++) + { + aep_app_conn_table[count].conn_state = NotConnected; + aep_app_conn_table[count].conn_hndl = 0; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37976.c b/gcc/testsuite/gcc.c-torture/compile/pr37976.c new file mode 100644 index 000000000..6b2ba63c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37976.c @@ -0,0 +1,6 @@ +void percent_x(int ch, char *p, char* ok_chars) +{ + char *cp = ch == 'a' ? p : ""; + for (;*(cp += __builtin_strspn (cp, ok_chars));) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37991.c b/gcc/testsuite/gcc.c-torture/compile/pr37991.c new file mode 100644 index 000000000..f374ea985 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37991.c @@ -0,0 +1,14 @@ +typedef int Int32; +void use_it(int); +void FindAndReadSignature(int processedSize) +{ + int numPrevBytes = 1; + for (;;) + { + int numBytesInBuffer = numPrevBytes + processedSize; + Int32 numTests = numBytesInBuffer - 1; + use_it (numTests); + numPrevBytes = numBytesInBuffer - numTests; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38123.c b/gcc/testsuite/gcc.c-torture/compile/pr38123.c new file mode 100644 index 000000000..b36ad118f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38123.c @@ -0,0 +1,13 @@ +/* PR target/38123 */ + +#include <stdarg.h> + +struct S { int i; double d; }; + +struct S +test (char *x, va_list ap) +{ + struct S s; + s = va_arg (ap, struct S); + return s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c new file mode 100644 index 000000000..8444cc78f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c @@ -0,0 +1,12 @@ +/* PR middle-end/38343 */ + +static struct S +{ + char f[6]; +} s[] = { {"01000"} }; + +char * +foo (void) +{ + return __builtin_stpcpy (s[0].f, "S0022"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343.c b/gcc/testsuite/gcc.c-torture/compile/pr38343.c new file mode 100644 index 000000000..589ba33a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38343.c @@ -0,0 +1,12 @@ +/* PR middle-end/38343 */ + +static struct A +{ + char f[6]; +} a[] = { {"01000"} }; + +void +foo (void) +{ + __builtin_stpcpy (a[0].f, "S0022"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38359.c b/gcc/testsuite/gcc.c-torture/compile/pr38359.c new file mode 100644 index 000000000..cb77b71dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38359.c @@ -0,0 +1,17 @@ +unsigned _ov_64_seek_lap (_Bool x1, _Bool x2, _Bool x3) +{ + unsigned ltmp_3978_7__PHI_TEMPORARY; + signed ltmp_4011_7; + + if (!x1 || !x2) + while (1) ; + + if (x3) + ltmp_3978_7__PHI_TEMPORARY = 0xffffff7e; + else + ltmp_3978_7__PHI_TEMPORARY = 1; + + ltmp_4011_7 = -1; + return ltmp_4011_7 >> ltmp_3978_7__PHI_TEMPORARY; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38360.c b/gcc/testsuite/gcc.c-torture/compile/pr38360.c new file mode 100644 index 000000000..463218d11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38360.c @@ -0,0 +1,9 @@ +/* PR middle-end/38360 */ + +int +main () +{ + fputs (""); + fputs_unlocked (""); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38428.c b/gcc/testsuite/gcc.c-torture/compile/pr38428.c new file mode 100644 index 000000000..aa32fc149 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38428.c @@ -0,0 +1,20 @@ +/* PR middle-end/38428 */ + +struct S +{ + volatile struct + { + unsigned int t : 1; + } s; +}; + +int +foo (struct S *x) +{ + int ret; + if (x->s.t) + ret = 0; + else + ret = 10; + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38505.c b/gcc/testsuite/gcc.c-torture/compile/pr38505.c new file mode 100644 index 000000000..b3b4a10c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38505.c @@ -0,0 +1,23 @@ +/* PR middle-end/38505 */ +/* { dg-do compile } */ + +struct S +{ + unsigned short a[50]; + unsigned short b[20]; +}; +extern void bar (struct S *); +extern void baz (unsigned short *); +extern unsigned short d[]; + +void +foo (void) +{ + struct S s; + unsigned short g[50]; + + baz (g); + __builtin_memcpy (&s, g, sizeof (g)); + __builtin_memcpy (s.b, d, sizeof (s.b)); + bar (&s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38554.c b/gcc/testsuite/gcc.c-torture/compile/pr38554.c new file mode 100644 index 000000000..7d40a223b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38554.c @@ -0,0 +1,45 @@ +typedef unsigned long sample; +struct pam +{ + sample maxval; +}; +typedef sample *tuple; +enum function + { + FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR, + FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT + }; +struct cmdlineInfo +{ + enum function function; + union + { + float divisor; + unsigned int shiftCount; + } + u; +}; +applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam, + struct pam const outpam, tuple * const inputRow, + tuple * const outputRow) +{ + float const oneOverDivisor = 1 / cmdline.u.divisor; + int col; + { + int plane; + { + sample const inSample = inputRow[col][plane]; + sample outSample; + switch (cmdline.function) + { + case FN_DIVIDE: + outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5)); + break; + case FN_SHIFTLEFT: + outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval; + } + outputRow[col][plane] = + ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample)); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38564.c b/gcc/testsuite/gcc.c-torture/compile/pr38564.c new file mode 100644 index 000000000..de365cc1f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38564.c @@ -0,0 +1,22 @@ +struct S +{ + struct S *n, *p; +} *s; + +void bar (void *); + +int +foo (int x) +{ + struct S p = { &p, &p }; + int i; + for (i = 0; i < x; i++) + bar (s); + return p.n == &p; +} + +int dialog_calendar(int state) +{ + int *obj = (state == 1 ? &state : 0); + return (obj == &state); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c b/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c new file mode 100644 index 000000000..87976546e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c @@ -0,0 +1,6 @@ + +int func_75 (int p_76) +{ + return (1 / (int) -(unsigned int)p_76); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c b/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c new file mode 100644 index 000000000..076359d74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c @@ -0,0 +1,6 @@ + +int func_75 (int p_76) +{ + return (1 / (int) -(unsigned int)p_76) ? 1 : p_76; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38661-1.c b/gcc/testsuite/gcc.c-torture/compile/pr38661-1.c new file mode 100644 index 000000000..065f12010 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38661-1.c @@ -0,0 +1,9 @@ +/* We used to ICE because we would wrap INT_MAX + into INT_MIN while doing the switch converison. */ + +const char *func(int val) { + switch (val) { + case - __INT_MAX__ -1 : return "foo"; + default: return ""; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38661.c b/gcc/testsuite/gcc.c-torture/compile/pr38661.c new file mode 100644 index 000000000..5d243c6be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38661.c @@ -0,0 +1,9 @@ +/* We used to ICE because we would wrap INT_MAX + into INT_MIN while doing the switch converison. */ + +const char *func(int val) { + switch (val) { + case __INT_MAX__: return "foo"; + default: return ""; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38752.c b/gcc/testsuite/gcc.c-torture/compile/pr38752.c new file mode 100644 index 000000000..3d409bf96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38752.c @@ -0,0 +1,25 @@ +typedef struct +{ + int baddr; +} mstruct_t; + +static struct +{ + unsigned int mapnum; + mstruct_t unused; +} mtab; + +static mstruct_t *mactab = &mtab.unused; + +int +main(void) +{ + int i; + int addr; + + for (i=1; i <= mtab.mapnum; i++) + if (addr < mactab[i].baddr) + break; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38771.c b/gcc/testsuite/gcc.c-torture/compile/pr38771.c new file mode 100644 index 000000000..7988680dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38771.c @@ -0,0 +1,7 @@ +/* PR middle-end/38771 */ + +unsigned long long +foo (long long x) +{ + return -(unsigned long long) (x ? : x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38789.c b/gcc/testsuite/gcc.c-torture/compile/pr38789.c new file mode 100644 index 000000000..1a26b8055 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38789.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/38789 */ +/* { dg-do compile } */ + +void +baz (int v) +{ + unsigned a = (v == 1) ? 1 : 2; + + if (__builtin_constant_p (a)) + asm volatile ("# constant %0" :: "i" (a)); + else + asm volatile ("# register %0" :: "r" (a)); + + a = 6; + if (__builtin_constant_p (a)) + asm volatile ("# constant %0" :: "i" (a)); + else + asm volatile ("# register %0" :: "r" (a)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38807.c b/gcc/testsuite/gcc.c-torture/compile/pr38807.c new file mode 100644 index 000000000..8b05d08aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38807.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/38807 */ + +int +baz (short x) +{ + return x; +} + +int a, b; + +int +bar (int x) +{ + if (baz (a ^ x ^ a)) + return b; + return 0; +} + +int +foo (void) +{ + return bar (a == 0 || 1 == 1 - a) ? 1 : bar (1 && a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38857.c b/gcc/testsuite/gcc.c-torture/compile/pr38857.c new file mode 100644 index 000000000..2492b77a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38857.c @@ -0,0 +1,22 @@ +static const int vs_total_ac_bits = 2680; +typedef struct EncBlockInfo { + short mb[64]; + unsigned char next[64]; +} EncBlockInfo; +inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) { + int size[5]; + int j, k, a, prev; + EncBlockInfo* b; + for(a=2; a==2 || vs_total_ac_bits < size[0]; a+=a){ + for (j=0; j<6*5; j++, b++) { + for (k= b->next[prev]; k<64; k= b->next[k]) { + if(b->mb[k] < a && b->mb[k] > -a){ + b->next[prev] = b->next[k]; + } + else{ + prev = k; + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38926.c b/gcc/testsuite/gcc.c-torture/compile/pr38926.c new file mode 100644 index 000000000..9c71a798c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38926.c @@ -0,0 +1,41 @@ +static inline int foo (unsigned _si1) +{ + if (_si1 != 0) + if (_si1 > 2147483647) + return 1; + return 0; +} + +static inline unsigned bar (unsigned _left, int _right) +{ + return (unsigned) _right >= 8 ? 1 : _left >> _right; +} + +unsigned g_2; +unsigned g_67; +volatile unsigned g_162; + +static inline int func_62 (unsigned p_63) +{ + p_63 = g_2 & g_67; + if (g_2) + ; + else if (p_63) + return 1; + g_67 = bar (p_63, g_2); + return 0; +} + +unsigned baz (void) +{ + if (g_2) + for (; g_2 <= -16; g_2 = foo (g_2)) + { + for (; g_162; g_162) + func_62 (func_62 (0)); + if (g_67) + break; + } + return g_2; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39041.c b/gcc/testsuite/gcc.c-torture/compile/pr39041.c new file mode 100644 index 000000000..cc58a8a37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39041.c @@ -0,0 +1,28 @@ +int test_bit(int nr, void *addr) +{ + int *a = (int *)addr; + int mask; + a += nr; + mask = 1 << nr; + return mask & *a; +} +struct { + struct { + int disabled; + } *data[1]; +} trace; +struct { + unsigned bits[1]; +} cpumask; +void inc(int *); +void dec(int *); +int foo(void) +{ + int cpu; + for (cpu = 0; cpu < 1; cpu++) { + if (test_bit(cpu, cpumask.bits)) + inc(&trace.data[cpu]->disabled); + if (!test_bit(cpu, cpumask.bits)) + dec(&trace.data[cpu]->disabled); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39202.c b/gcc/testsuite/gcc.c-torture/compile/pr39202.c new file mode 100644 index 000000000..f79b83194 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39202.c @@ -0,0 +1,33 @@ +typedef struct +{ + union + { + int * aaa; + } u; +} t_a; + +typedef struct +{ + unsigned bbb : 1; +} t_b; + +typedef struct +{ + int ccc; + t_a ddd; + t_b eee; + int fff; +} t_c; + +typedef struct t_d +{ + t_c f1; + t_c f2; +} t_d; + +void foo (void) +{ + t_d ggg; + ggg.f1 = ggg.f2; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39360.c b/gcc/testsuite/gcc.c-torture/compile/pr39360.c new file mode 100644 index 000000000..0bd631144 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39360.c @@ -0,0 +1,16 @@ +/* PR middle-end/39360 */ + +static int a[] = { 1 }; + +static inline void +bar (int **x) +{ + static int *c[2] = { 0, a }; + *x = c[1]; +} + +int +foo (int **x) +{ + bar (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39394.c b/gcc/testsuite/gcc.c-torture/compile/pr39394.c new file mode 100644 index 000000000..325a08ff4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39394.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/39394 */ + +char *p; +int x; + +static inline void +f1 (int n) +{ + asm volatile ("" : "=m" (*(struct { char x[n]; } *) p)); +} + +static inline void +f2 (void) +{ + x ? f1 (1) : f1 (2); +} + +static inline void +f3 (void) +{ + f2 (); +} + +void +f4 (void) +{ + f3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c new file mode 100644 index 000000000..a9559c73a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c @@ -0,0 +1,7 @@ +typedef struct page { + unsigned long flags; +} mem_map_t; +static inline void set_page_zone(struct page *page, unsigned long zone_num) +{ + page->flags &= ~(~0UL << (64 - 8)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c new file mode 100644 index 000000000..e3cefb7a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 / 0) / 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c new file mode 100644 index 000000000..f9fa3b9d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 ? 1 / 0 : 1 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c new file mode 100644 index 000000000..2426ee28f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 / 0 ? 1 : 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c new file mode 100644 index 000000000..0cae4de94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-w -std=c99" } */ +int i; +void +f (void) +{ + i = (1 / 0, 1 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39636.c b/gcc/testsuite/gcc.c-torture/compile/pr39636.c new file mode 100644 index 000000000..ceddbb3ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39636.c @@ -0,0 +1,11 @@ +typedef float real; +typedef real rvec[3]; +void calc_dx2dx(real *, real *); +void phi_sr(int nj,rvec x[],int k) +{ + int i,j; + for(i=0; (i<nj-1); i++) + for(j=i+1; (j<nj); j++) + if (k) + calc_dx2dx(x[i],x[j]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39648.c b/gcc/testsuite/gcc.c-torture/compile/pr39648.c new file mode 100644 index 000000000..bb901fee0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39648.c @@ -0,0 +1,12 @@ +void +yysyntax_error (char *yyp) +{ + char const *yyf; + char yyformat[5]; + + yyf = yyformat; + while ((*yyp = *yyf) != '\0') { + if (yyf[1] == 's') + yyf += 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39673-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39673-1.c new file mode 100644 index 000000000..d2e038776 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39673-1.c @@ -0,0 +1,6 @@ +unsigned long f1(); +int f2(); + +int store_aff_word(int x) { + return (int) (x ? f1() : f2()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39673-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39673-2.c new file mode 100644 index 000000000..68407a437 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39673-2.c @@ -0,0 +1,6 @@ +unsigned long long f1(); +int f2(); + +int store_aff_word(int x) { + return (int) (x ? f1() : f2()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39779.c b/gcc/testsuite/gcc.c-torture/compile/pr39779.c new file mode 100644 index 000000000..d1680df29 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39779.c @@ -0,0 +1,5 @@ +int test (char v1) +{ + v1 >>= 0xdebecced; + return v1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39824.c b/gcc/testsuite/gcc.c-torture/compile/pr39824.c new file mode 100644 index 000000000..362fb17b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39824.c @@ -0,0 +1,26 @@ +static const double internalEndianMagic = 7.949928895127363e-275; +static const unsigned char ieee_754_mantissa_mask[] = { 0x00, 0x0F, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF }; +static inline int +trio_isnan (double number) +{ + int has_mantissa = 0; + unsigned int i; + unsigned char current; + for (i = 0; i < (unsigned int)sizeof(double); i++) + { + current = ((unsigned char *)&number)[(((unsigned char + *)&internalEndianMagic)[7-(i)])]; + has_mantissa |= (current & ieee_754_mantissa_mask[i]); + } + return has_mantissa; +} +void +xmlXPathEqualNodeSetFloat(int nodeNr, double v) +{ + int i; + for (i=0; i<nodeNr; i++) + if (!trio_isnan(v)) + break; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39834.c b/gcc/testsuite/gcc.c-torture/compile/pr39834.c new file mode 100644 index 000000000..ecc3977a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39834.c @@ -0,0 +1,13 @@ +/* { dg-options "-O1 -Winline" } */ +void quit_mined (); +void bottom_line (); +typedef enum { False, True } FLAG; +inline void +nextfile (FLAG exitiflast) +{ + if (exitiflast) + quit_mined (); + else + bottom_line (); + nextfile (True); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39845.c b/gcc/testsuite/gcc.c-torture/compile/pr39845.c new file mode 100644 index 000000000..bd731989d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39845.c @@ -0,0 +1,45 @@ + +/* { dg-options "-fno-short-enums" {target short_enums} } */ +typedef union tree_node *tree; +enum tree_code { EXCESS_PRECISION_EXPR }; +enum built_in_function { BUILT_IN_ACOS, BUILT_IN_FPCLASSIFY, BUILT_IN_ISFINITE }; +struct tree_base { + __extension__ enum tree_code code : 16; + unsigned side_effects_flag : 1; +}; +struct tree_exp { + tree operands[1]; +}; +struct tree_function_decl { + __extension__ enum built_in_function function_code : 11; + unsigned static_ctor_flag : 1; +}; +union tree_node { + struct tree_base base; + struct tree_function_decl function_decl; + struct tree_exp exp; +}; +static tree +convert_arguments (tree fundecl) +{ + tree val = (void *)0; + unsigned int parmnum; + unsigned char type_generic_remove_excess_precision = 0; + switch (((fundecl)->function_decl.function_code)) + { + case BUILT_IN_ISFINITE: + case BUILT_IN_FPCLASSIFY: + type_generic_remove_excess_precision = 1; + } + for (parmnum = 0;; ++parmnum) + if (((enum tree_code) (val)->base.code) == EXCESS_PRECISION_EXPR + && !type_generic_remove_excess_precision) + val = ((val)->exp.operands[0]); + return val; +} +tree +build_function_call_vec (tree function) +{ + return convert_arguments (function); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39886.c b/gcc/testsuite/gcc.c-torture/compile/pr39886.c new file mode 100644 index 000000000..e85dbb341 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39886.c @@ -0,0 +1,12 @@ +/* PR middle-end/39886 */ + +int foo (int); + +volatile unsigned char g; + +void bar (int p) +{ + char l = 0xE1; + func ((foo ((p & g) <= l), 1)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c new file mode 100644 index 000000000..1abb5ccb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c @@ -0,0 +1,9 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +extern __m128 _mm_sub_ps (__m128 __A, __m128 __B); +extern __m128 _mm_mul_ps (__m128 __A, __m128 __B); +__m128 +vq_nbest(const __m128 *codebook, __m128 d, __m128 in) +{ + return _mm_sub_ps(d, _mm_mul_ps(in, *codebook++)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c new file mode 100644 index 000000000..6f0d30cc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c @@ -0,0 +1,8 @@ +typedef _Complex float __m128; +extern __m128 _mm_sub_ps (__m128 __A, __m128 __B); +extern __m128 _mm_mul_ps (__m128 __A, __m128 __B); +__m128 +vq_nbest(const __m128 *codebook, __m128 d, __m128 in) +{ + return _mm_sub_ps(d, _mm_mul_ps(in, *codebook++)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39937.c b/gcc/testsuite/gcc.c-torture/compile/pr39937.c new file mode 100644 index 000000000..d02310532 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39937.c @@ -0,0 +1,12 @@ +int foo (__const char *__restrict __s); +static void +read_anisou(char line[]) +{ + foo (line+1); +} +void +read_pdbfile(void) +{ + char line[4096]; + read_anisou (line); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39941.c b/gcc/testsuite/gcc.c-torture/compile/pr39941.c new file mode 100644 index 000000000..b6209086b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39941.c @@ -0,0 +1,12 @@ +typedef void (*entry_func) (void) __attribute__ ((noreturn)); +extern entry_func entry_addr; +static void bsd_boot_entry (void) +{ + stop (); +} +void bsd_boot (void) +{ + entry_addr = (entry_func) bsd_boot_entry; + (*entry_addr) (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39943.c b/gcc/testsuite/gcc.c-torture/compile/pr39943.c new file mode 100644 index 000000000..537ba4370 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39943.c @@ -0,0 +1,7 @@ +void gl_fog_index_pixels(float f, unsigned int n, unsigned int index[]) +{ + unsigned int i; + for (i=0; i<n; i++) + index[i] = (unsigned int) ((float) index[i] + (1.0F-f)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39983.c b/gcc/testsuite/gcc.c-torture/compile/pr39983.c new file mode 100644 index 000000000..67081211c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39983.c @@ -0,0 +1,17 @@ +typedef struct { + int *p; +} *A; + +extern const int a[1]; +extern const int b[1]; + +void foo() +{ + A x; + A y; + static const int * const c[] = { b }; + + x->p = (int*)c[0]; + y->p = (int*)a; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39999.c b/gcc/testsuite/gcc.c-torture/compile/pr39999.c new file mode 100644 index 000000000..c46a651a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39999.c @@ -0,0 +1,18 @@ +void foo(void *); +void +MMAPGCD (int *A1, int *A2) +{ + int *t; + + do + { + t = A1; + A1 = A2; + A2 = t; + } + while (A2[-1]); + + foo (A1-1); + foo (A2-1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40023.c b/gcc/testsuite/gcc.c-torture/compile/pr40023.c new file mode 100644 index 000000000..93d8f68a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40023.c @@ -0,0 +1,11 @@ +typedef __builtin_va_list va_list; +typedef struct { + va_list ap; +} ScanfState; +void +GetInt(ScanfState *state, long llval) +{ + *__builtin_va_arg(state->ap,long *) = llval; + __builtin_va_end(state->ap); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40026.c b/gcc/testsuite/gcc.c-torture/compile/pr40026.c new file mode 100644 index 000000000..0d08f0dc8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40026.c @@ -0,0 +1,15 @@ +typedef struct { + unsigned long bits; +} S; +struct T { + S span; + int flags; +}; + +struct T f(int x) +{ + return (struct T) { + .span = (S) { 0UL }, + .flags = (x ? 256 : 0), + }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40035.c b/gcc/testsuite/gcc.c-torture/compile/pr40035.c new file mode 100644 index 000000000..1bf1a7c4c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40035.c @@ -0,0 +1,20 @@ +typedef __SIZE_TYPE__ size_t; +void *memmove (void *dest, const void *src, size_t count); +size_t strlen (const char *s); + +int +foo (char *param, char *val) +{ + if (val) + { + if (val == param + strlen (param) + 1) + val[-1] = '='; + else if (val == param + strlen (param) + 2) + { + val[-2] = '='; + memmove (val - 1, val, strlen (val) + 1); + val--; + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40080.c b/gcc/testsuite/gcc.c-torture/compile/pr40080.c new file mode 100644 index 000000000..e36f14273 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40080.c @@ -0,0 +1,44 @@ +extern void *ff(void*,int); + +struct lpgl { struct lpgl *next; }; +struct lpgd { struct lpgl *first; }; + +typedef int (*xfn)( ); +static void xDP_IF_EnumGroupsInGroup ( void *a, int b, xfn fn) +{ + struct lpgd *lpGData; + struct lpgl *lpGList; + + if( ( lpGData = ff( a, b ) ) == ((void *)0) ) + return; + + if( lpGData->first == ((void *)0) ) + return; + lpGList = lpGData->first; + + for( ;; ) { + if( !(*fn)( ) ) + return; + if( lpGList->next == ((void *)0) ) + break; + lpGList = lpGList->next; + } + return; +} + + +static int +xcbDeletePlayerFromAllGroups() { + xDP_IF_EnumGroupsInGroup(0, 0, 0); + return 1; +} + +void xDP_IF_EnumGroups( xfn fn) { + xDP_IF_EnumGroupsInGroup( 0, 0, fn); +} + +static void xDP_IF_DestroyPlayer () { + xDP_IF_EnumGroups( xcbDeletePlayerFromAllGroups); +} + +void* foo=xDP_IF_DestroyPlayer; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40204.c b/gcc/testsuite/gcc.c-torture/compile/pr40204.c new file mode 100644 index 000000000..149302a83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40204.c @@ -0,0 +1,15 @@ +/* { dg-require-effective-target int32plus } */ +/* PR middle-end/40204 */ + +struct S +{ + unsigned int a : 4; + unsigned int b : 28; +} s; +char c; + +void +f (void) +{ + s.a = (c >> 4) & ~(1 << 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40233.c b/gcc/testsuite/gcc.c-torture/compile/pr40233.c new file mode 100644 index 000000000..b3487edde --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40233.c @@ -0,0 +1,10 @@ +typedef int aligned __attribute__((aligned(64))); +struct Frame { + aligned i; +}; + +void foo(struct Frame *p) +{ + aligned *q = &p->i; + *q = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40252.c b/gcc/testsuite/gcc.c-torture/compile/pr40252.c new file mode 100644 index 000000000..f58e799b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40252.c @@ -0,0 +1,6 @@ +typedef unsigned int uint32_t; +static void IP(uint32_t v[2]) +{ + v[0] = ((v[0] << 1) | ((v[0] >> 31) & 1L)) & 0xffffffffL; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40291.c b/gcc/testsuite/gcc.c-torture/compile/pr40291.c new file mode 100644 index 000000000..d50bbee66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40291.c @@ -0,0 +1,7 @@ +/* PR middle-end/40291 */ + +int +foo (void *x, char *y, unsigned long long z) +{ + return memcmp (x, y, z); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40321.c b/gcc/testsuite/gcc.c-torture/compile/pr40321.c new file mode 100644 index 000000000..a2f83ed8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40321.c @@ -0,0 +1,12 @@ +struct X { int flag; int pos; }; +int foo(struct X *a, struct X *b) +{ + while (1) + { + if (a->flag) + break; + ({ struct X *tmp = a; a = b; b = tmp; }); + } + + return a->pos + b->pos; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40351.c b/gcc/testsuite/gcc.c-torture/compile/pr40351.c new file mode 100644 index 000000000..9b7e0ccfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40351.c @@ -0,0 +1,22 @@ +/* PR tree-optimizations/40351 */ + +struct IO_APIC_route_entry { + unsigned int vector : 8; + unsigned int delivery_mode : 1; + unsigned int mask : 1; + unsigned int __reserved_2 : 15; + unsigned int __reserved_3 : 8; +} __attribute__ ((packed)); +union entry_union { + struct { + unsigned int w1, w2; + }; + struct IO_APIC_route_entry entry; +}; +unsigned int io_apic_read(void); +struct IO_APIC_route_entry ioapic_read_entry(void) +{ + union entry_union eu; + eu.w1 = io_apic_read(); + return eu.entry; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40432.c b/gcc/testsuite/gcc.c-torture/compile/pr40432.c new file mode 100644 index 000000000..767f59498 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40432.c @@ -0,0 +1,17 @@ +/* Test that SRA produces valid gimple when handling both type punning by means + of VCE and creating an access to a union. */ + +union U { + struct something *sth; + void *nothing; +}; + +void +foo (union U *target, void *p) +{ + union U u; + + u.nothing = p; + *target = u; + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40556.c b/gcc/testsuite/gcc.c-torture/compile/pr40556.c new file mode 100644 index 000000000..625175d77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40556.c @@ -0,0 +1,11 @@ +struct A {}; + +struct A foo() +{ + return foo(); +} + +void bar() +{ + foo(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40570.c b/gcc/testsuite/gcc.c-torture/compile/pr40570.c new file mode 100644 index 000000000..7c3f4d83b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40570.c @@ -0,0 +1,22 @@ +extern void anything(int); + +static int foo(int i); + +static int bar(int i) { foo(i); } + +extern int j; + +static int foo(int i) +{ + if (j) + anything(j); + return bar(i); +} + +int baz() +{ + foo(0); + if (baz()) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40582.c b/gcc/testsuite/gcc.c-torture/compile/pr40582.c new file mode 100644 index 000000000..51234da40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40582.c @@ -0,0 +1,18 @@ +struct A +{ + void* q; + short i; +}; + +union U +{ + char* p; + struct A a; +}; + +struct A foo(union U u) +{ + struct A a = { 0, 0 }; + a = u.a; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40640.c b/gcc/testsuite/gcc.c-torture/compile/pr40640.c new file mode 100644 index 000000000..7dae7ca81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40640.c @@ -0,0 +1,15 @@ +void decode_opic_address(int *); +void sim_io_printf_filtered2 (int, unsigned); +void +hw_opic_io_read_buffer(int index) +{ + unsigned reg = 0; + decode_opic_address(&index); + switch (index) + { + case 0: + reg = 1; + } + sim_io_printf_filtered2 (index, reg); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40676.c b/gcc/testsuite/gcc.c-torture/compile/pr40676.c new file mode 100644 index 000000000..b04262882 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40676.c @@ -0,0 +1,33 @@ +extern int f1(); +extern int f2(void*); +extern void* f3(int); +int xmsih; +typedef unsigned short XWCHAR; + +inline unsigned int xstrlenW( const XWCHAR *str ) +{ + const XWCHAR *s = str; + while (*s) s++; + return s - str; +} + + +static int msi_dialog_register_class( void ) +{ + int cls; + + if( !f2( &cls ) ) + return 0; + if( !f2( &cls ) ) + return 0; + xmsih = f1(); + if( !xmsih ) + return 0; + return 1; +} + +void *xmsi_dialog_create(const XWCHAR* szDialogName) +{ + msi_dialog_register_class(); + return f3(xstrlenW(szDialogName)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40692.c b/gcc/testsuite/gcc.c-torture/compile/pr40692.c new file mode 100644 index 000000000..567516e69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40692.c @@ -0,0 +1,15 @@ +/* PR middle-end/40692 */ + +#define M1(x) (((x) & 0x00000002) ? 0x2 : ((x) & 0x1)) +#define M2(x) (((x) & 0x0000000c) ? M1 ((x) >> 2) << 2 : M1 (x)) +#define M3(x) (((x) & 0x000000f0) ? M2 ((x) >> 4) << 4 : M2 (x)) +#define M4(x) (((x) & 0x0000ff00) ? M3 ((x) >> 8) << 8 : M3 (x)) +#define M5(x) (((x) & 0xffff0000) ? M4 ((x) >> 16) << 16 : M4 (x)) + +struct A { char e; char f; }; + +long +foo (void) +{ + return M5 (4096UL - (long) &((struct A *) 0)->f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40753.c b/gcc/testsuite/gcc.c-torture/compile/pr40753.c new file mode 100644 index 000000000..507303dac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40753.c @@ -0,0 +1,20 @@ +typedef struct { + unsigned nargs; +} ffi_cif; +typedef struct { + char tramp[24]; + ffi_cif *cif; +} ffi_closure; +extern void *memcpy (void *, const void *, __SIZE_TYPE__); +extern void ffi_closure_LINUX64 (void); + +int +ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif) +{ + void **tramp = (void **) &closure->tramp[0]; + + memcpy (tramp, (char *) ffi_closure_LINUX64, 16); + closure->cif = cif; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40964.c b/gcc/testsuite/gcc.c-torture/compile/pr40964.c new file mode 100644 index 000000000..51639940e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40964.c @@ -0,0 +1,10 @@ +struct alloc2 { + int bla; + char * __restrict data; + char * __restrict data2; +}; +struct alloc2 b; +void * f (void) +{ + return b.data; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c b/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c new file mode 100644 index 000000000..8aef66dbd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c @@ -0,0 +1,17 @@ +typedef int (*FARPROC)(); + +typedef int (*LPFN_ACCEPTEX)(void*); +static LPFN_ACCEPTEX acceptex_fn; + +int xWSAIoctl(void*); +static void get_fn(FARPROC* fn) +{ + FARPROC func; + if (!xWSAIoctl( &func)) + *fn = func; +} + +void get_fn_pointers() +{ + get_fn((FARPROC*)&acceptex_fn); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c b/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c new file mode 100644 index 000000000..766778d41 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c @@ -0,0 +1,15 @@ +typedef int *FARPROC; +static int * __restrict__ acceptex_fn; + +int xWSAIoctl(void*); +static void get_fn(FARPROC* fn) +{ + FARPROC func; + if (!xWSAIoctl( &func)) + *fn = func; +} + +void get_fn_pointers() +{ + get_fn((FARPROC*)&acceptex_fn); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41016.c b/gcc/testsuite/gcc.c-torture/compile/pr41016.c new file mode 100644 index 000000000..57bddb49d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41016.c @@ -0,0 +1,17 @@ +typedef struct _IO_FILE FILE; +void +CompareRNAStructures (FILE * ofp, int start, int L, char *ss_true, char *ss) +{ + int i; + float agree = 0.; + float pairs = 0.; + float pairs_true = 0.; + for (i = 0; i < L; i++) + { + pairs_true += 1.; + agree += 1.; + } + if (((int) pairs % 2 != 0) || ((int) pairs_true % 2 != 0) + || ((int) agree % 2 != 0)) + Die ("Error in CompareRNAStrutures(); odd number of paired nucleotides\n"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41101.c b/gcc/testsuite/gcc.c-torture/compile/pr41101.c new file mode 100644 index 000000000..8d21a00ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41101.c @@ -0,0 +1,19 @@ +int func(int); + +void +bug(int* x, int* y, unsigned long int N) +{ + unsigned long int i; + int* t; + + while (1) + { + for (i=1; i<=N; i++) + { + y[i] = func(x[i] - x[1]); + if (y[i]) + return; + } + t=x; x=y; y=t; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41163.c b/gcc/testsuite/gcc.c-torture/compile/pr41163.c new file mode 100644 index 000000000..c22483783 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41163.c @@ -0,0 +1,10 @@ +struct option { + void *value; +}; +void parse_options (struct option *); +void cmd_grep(void) +{ + struct option options[] = { { &options } }; + parse_options(options); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41181.c b/gcc/testsuite/gcc.c-torture/compile/pr41181.c new file mode 100644 index 000000000..5fafb020e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41181.c @@ -0,0 +1,11 @@ +/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ +char paths[1024]; +static void x264_slicetype_path(char (*best_paths)[250], int n, int length) +{ + __builtin_memcpy (best_paths[n], paths, length); +} +void x264_slicetype_analyse(int n, int length) +{ + char best_paths[250][250]; + x264_slicetype_path (best_paths, n, length); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c b/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c new file mode 100644 index 000000000..017174938 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c @@ -0,0 +1,6 @@ +typedef long unsigned int size_t; +int _lae_process_opts(char *pr, char *pe) +{ + return (strlen ("on") < ((size_t) ((pe-&pr[2])>(strlen("on")) + ? (pe-&pr[2]) : (strlen("on"))))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41282.c b/gcc/testsuite/gcc.c-torture/compile/pr41282.c new file mode 100644 index 000000000..3a0f02d63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41282.c @@ -0,0 +1,20 @@ +struct S +{ + unsigned int iu; +}; + +union U +{ + struct S s; + signed int is; +}; + +extern signed int bar (); + +struct S foo (void) +{ + union U u; + + u.is = bar (); + return u.s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41469.c b/gcc/testsuite/gcc.c-torture/compile/pr41469.c new file mode 100644 index 000000000..b89ee6391 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41469.c @@ -0,0 +1,14 @@ +/* { dg-options "-fexceptions" } */ + +void +af (void *a) +{ +} +void +bf (void) +{ + int i = 1; + char v[i]; + af (v); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41634.c b/gcc/testsuite/gcc.c-torture/compile/pr41634.c new file mode 100644 index 000000000..976e463e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41634.c @@ -0,0 +1,19 @@ +extern int _xgetw(); +extern int foo(char*); + +void test_readmode( int ascii_mode ) +{ + static const char outbuffer[] + = "0,1,2,3,4,5,6,7,8,9\r\n\r\nA,B,C,D,E\r\nX,Y,Z"; + char buffer[2*512 +256]; + int i, j, ao; + unsigned int fp; + + foo(buffer); + + for (i=0, j=0; i<6; i++) { + if (ao==0 || outbuffer[fp-3+i] != '\r') + buffer[j++] = outbuffer[fp-3+i]; + } + _xgetw(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41646.c b/gcc/testsuite/gcc.c-torture/compile/pr41646.c new file mode 100644 index 000000000..f07b6ba19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41646.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/41646 */ + +struct A { unsigned long a; }; +struct B { unsigned short b, c, d; }; +struct B bar (unsigned long); + +char * +foo (char *a, struct A *x) +{ + struct B b = bar (x->a); + unsigned char c; + unsigned short d; + a[3] = ((unsigned char) (b.b % 10) + 48); + d = b.b / 10; + a[2] = ((unsigned char) (d % 10) + 48); + d = d / 10; + a[1] = ((unsigned char) (d % 10) + 48); + a[0] = ((unsigned char) ((d / 10) % 10) + 48); + a[4] = 46; + c = (unsigned char) b.c; + a[6] = (c % 10 + 48); + a[5] = ((c / 10) % 10 + 48); + a[7] = 46; + c = b.d; + a[9] = (c % 10 + 48); + a[8] = ((c / 10) % 10 + 48); + return a + 10; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41661.c b/gcc/testsuite/gcc.c-torture/compile/pr41661.c new file mode 100644 index 000000000..658e4288b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41661.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/41661 */ +/* { dg-do compile } */ +/* { dg-options "-fno-early-inlining" } */ + +int g; + +void foo (int x) +{ + g = x; +} + +void bar (double d) +{ + foo (d == 1); +} + +void baz (int a) +{ + bar (1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41679.c b/gcc/testsuite/gcc.c-torture/compile/pr41679.c new file mode 100644 index 000000000..aa10cb612 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41679.c @@ -0,0 +1,15 @@ +/* { dg-options "-g" } */ + +extern int a; +extern char b; +extern int foo (void); + +void +test (void) +{ + int c; + b = foo () ? '~' : '\0'; + while ((c = foo ())) + if (c == '7') + a = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41728.c b/gcc/testsuite/gcc.c-torture/compile/pr41728.c new file mode 100644 index 000000000..df379d930 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41728.c @@ -0,0 +1,12 @@ +int a[8]; +int s244(void) +{ + int lrc, j; + lrc = 0; + for (j=0; j<7; j++) + if(a[j] != a[j+1]) + lrc = 1; + if (lrc != 0) + return 0; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41987.c b/gcc/testsuite/gcc.c-torture/compile/pr41987.c new file mode 100644 index 000000000..7bb49192c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41987.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/41987 */ + +#define TESTIT(TYPE) do { \ + _Complex TYPE ylm; \ + TYPE nbond; \ + ylm = 0; \ + nbond = 0; \ + ylm = ylm / nbond; \ +} while (0) + +void qparm_colvar(void) +{ + TESTIT (float); + TESTIT (double); + TESTIT (long double); + + TESTIT (char); + TESTIT (short); + TESTIT (int); + TESTIT (long); + TESTIT (long long); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c new file mode 100644 index 000000000..f19123eaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c @@ -0,0 +1,24 @@ +typedef void* Ptr; + +struct A +{ + int i; + union + { + Ptr p; + char *q; + } u; +}; + +static void foo(struct A *p, char *q) +{ + if (p->i) + p->u.p = 0; + else + p->u.q = q; +} + +void bar(struct A *p, char *q) +{ + foo(p, q); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c b/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c new file mode 100644 index 000000000..14cb36d1c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c @@ -0,0 +1,32 @@ +typedef struct +{ + void *p; +} Ptr; + +struct A +{ + int i; + union + { + Ptr p; + char *q; + } u; +}; + +extern Ptr get_stuff (void); +extern void use_stuff (char *); + +static void foo(struct A p, char *q) +{ + if (p.i) + p.u.p = get_stuff (); + else + p.u.q = q; + + use_stuff (p.u.q); +} + +void bar(struct A *p, char *q) +{ + foo(*p, q); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42049.c b/gcc/testsuite/gcc.c-torture/compile/pr42049.c new file mode 100644 index 000000000..b2ebe52ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42049.c @@ -0,0 +1,27 @@ +/* PR middle-end/42049 */ + +extern char *strcpy (char *s1, const char *s2); +struct S { char s[4]; }; + +int +foo (int x, char **y) +{ + char const *a; + char const *b; + struct S s[9]; + long i; + if (x > 1) + a = y[1]; + else + a = "abc"; + if (x > 2) + b = y[2]; + else + b = "def"; + strcpy (s[0].s, a); + strcpy (s[1].s, b); + for (i = 2; i < x - 2 && i < 8; i++) + strcpy (s[i].s, y[i + 1]); + s[i].s[0] = '\0'; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42164.c b/gcc/testsuite/gcc.c-torture/compile/pr42164.c new file mode 100644 index 000000000..7b94aefe7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42164.c @@ -0,0 +1,25 @@ +typedef struct +{ + unsigned long long pte; +} pte_t; +pte_t mk_swap_pte (unsigned long offset) +{ + pte_t pte; + pte.pte = (offset << 40); + return pte; +} +int pte_file (pte_t pte) +{ + return pte.pte & (1 << 4); +} +typedef struct +{ + unsigned long val; +} swp_entry_t; +pte_t swp_entry_to_pte (swp_entry_t entry) +{ + swp_entry_t arch_entry; + arch_entry = (swp_entry_t){mk_swap_pte (swp_offset (entry)).pte}; + __BUG_ON ((unsigned long) pte_file ((pte_t) {arch_entry.val})); + return (pte_t) {arch_entry.val}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c new file mode 100644 index 000000000..96936c5e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c @@ -0,0 +1,28 @@ +union U +{ + double d; + __complex__ int c; +}; + +double gd; +extern double bar (union U); + +double foo (int b, double d, int c1, int c2) +{ + union U u; + double r; + + if (b) + { + u.d = d; + r = u.d; + } + else + { + __real__ u.c = c1; + __imag__ u.c = c2; + r = bar (u); + } + + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c b/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c new file mode 100644 index 000000000..40ae077f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c @@ -0,0 +1,28 @@ +union U +{ + __complex__ int ci; + __complex__ float cf; +}; + +float gd; +extern float bar (union U); + +float foo (int b, double f1, double f2, int c1, int c2) +{ + union U u; + double r; + + if (b) + { + __real__ u.cf = f1; + __imag__ u.cf = f2; + } + else + { + __real__ u.ci = c1; + __imag__ u.ci = c2; + } + + r = bar (u); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c b/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c new file mode 100644 index 000000000..ccc0d7a19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c @@ -0,0 +1,27 @@ +union U +{ + __complex__ int ci; + __complex__ float cf; +}; + +float gd; +extern float bar (float, float); + +float foo (int b, union U u) +{ + float f1, f2, r; + + if (b) + { + f1 = __real__ u.cf; + f1 = __imag__ u.cf; + } + else + { + f1 = __real__ u.ci; + f1 = __imag__ u.ci; + } + + r = bar (f1, f2); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42234.c b/gcc/testsuite/gcc.c-torture/compile/pr42234.c new file mode 100644 index 000000000..81bec9db8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42234.c @@ -0,0 +1,14 @@ +/* { dg-options "-g" } */ + +void +foo (int x) +{ + struct S { int s; } d = { 1 }; + unsigned int e = 1; + if (x) + e = x && d.s; + else + for (e = 0; e <= 3; e--) + ; + e++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42237.c b/gcc/testsuite/gcc.c-torture/compile/pr42237.c new file mode 100644 index 000000000..58db8660c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42237.c @@ -0,0 +1,32 @@ +struct A +{ + int p; +}; + +struct B +{ + struct A n; + struct A m; + int x; + int y; + int z; +}; + +extern int g1, g2; + +static void __attribute__((noinline)) foo (struct B *b) +{ + int t; + + t = b->n.p; + g1 = t; + b->n.p = t+1; + g2 = b->m.p; + + b->m = b->n; +} + +void bar (struct B *b) +{ + foo (b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42299.c b/gcc/testsuite/gcc.c-torture/compile/pr42299.c new file mode 100644 index 000000000..5a9199f27 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42299.c @@ -0,0 +1,23 @@ +/* { dg-options "-g" } */ + +static int +foo (int x, int y) +{ + if (y) + goto lab; + if (x) + y = 0; + if (y) + goto lab; + y = 0; +lab: + return y; +} + +void +baz (int x, int y) +{ + y = foo (x, y); + if (y != 0) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42347.c b/gcc/testsuite/gcc.c-torture/compile/pr42347.c new file mode 100644 index 000000000..e98b86984 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42347.c @@ -0,0 +1,16 @@ +/* PR bootstrap/42347 */ + +long +foo (long x, long y) +{ + x = x & y; + switch (y) + { + case 63L: x >>= 0; break; + case 4032L: x >>= 6; break; + case 258048L: x >>= 12; break; + case 16515072L: x >>= 18; break; + default: __builtin_unreachable (); + } + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42398.c b/gcc/testsuite/gcc.c-torture/compile/pr42398.c new file mode 100644 index 000000000..a33bebf79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42398.c @@ -0,0 +1,6 @@ +int ptrace_setregs(void) +{ + union { unsigned int l; int t; } __gu_tmp; + __asm__ __volatile__("" : "=r" (__gu_tmp.l)); + return __gu_tmp.t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42559.c b/gcc/testsuite/gcc.c-torture/compile/pr42559.c new file mode 100644 index 000000000..25f7fd6e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42559.c @@ -0,0 +1,8 @@ +void jumpfunc(int copy, void *p) +{ + void *l = &&jumplabel; + if (copy) + __builtin___memcpy_chk (p, l, 128, __builtin_object_size (p, 0)); +jumplabel: + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42632.c b/gcc/testsuite/gcc.c-torture/compile/pr42632.c new file mode 100644 index 000000000..a6778537a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42632.c @@ -0,0 +1,16 @@ +static inline __attribute__((always_inline)) int +__pskb_trim(void) +{ + return ___pskb_trim(); +} +static inline __attribute__((always_inline)) +int pskb_trim(void) +{ + return __pskb_trim(); +} +int ___pskb_trim(void) +{ + pskb_trim(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42703.c b/gcc/testsuite/gcc.c-torture/compile/pr42703.c new file mode 100644 index 000000000..4805b17b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42703.c @@ -0,0 +1,12 @@ +__extension__ typedef unsigned long long int uint64_t; +typedef uint64_t ScmUInt64; +void swapb64(ScmUInt64 *loc) +{ + union { + ScmUInt64 l; + unsigned char c[4]; + } dd; + unsigned char t; + dd.l = *loc; + (t = dd.c[3], dd.c[3] = dd.c[4], dd.c[4] = t); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42705.c b/gcc/testsuite/gcc.c-torture/compile/pr42705.c new file mode 100644 index 000000000..3d7b22da8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42705.c @@ -0,0 +1,58 @@ +typedef int GLint; +typedef unsigned char GLubyte; +typedef unsigned int uint32_t; +struct radeon_bo { + void *ptr; + uint32_t flags; +}; +struct radeon_renderbuffer { + struct radeon_bo *bo; + unsigned int cpp; + int has_surface; +}; +static inline +GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, + GLint x, GLint y, GLint is_depth, GLint is_stencil) +{ + GLint element_bytes = rrb->cpp; + GLint num_samples = 1; + GLint tile_width = 8; + GLint tile_height = 8; + GLint tile_thickness = 1; + GLint tile_bytes; + GLint tiles_per_row; + GLint slice_offset; + GLint tile_row_index; + GLint tile_column_index; + GLint tile_offset; + GLint pixel_number = 0; + GLint element_offset; + GLint offset = 0; + tile_bytes = tile_width * tile_height * tile_thickness + * element_bytes * num_samples; + tile_column_index = x / tile_width; + tile_offset = ((tile_row_index * tiles_per_row) + + tile_column_index) * tile_bytes; + if (is_depth) { + } + else { + GLint sample_offset; + switch (element_bytes) { + case 1: pixel_number |= ((x >> 0) & 1) << 0; + } + element_offset = sample_offset + (pixel_number * element_bytes); + } + offset = slice_offset + tile_offset + element_offset; + return offset; +} +GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb, + GLint x, GLint y) +{ + GLubyte *ptr = rrb->bo->ptr; + uint32_t mask = 1 | 2; + GLint offset; + if (rrb->has_surface || !(rrb->bo->flags & mask)) { + offset = r600_1d_tile_helper(rrb, x, y, 0, 0); + } + return &ptr[offset]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c new file mode 100644 index 000000000..9124a85b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c @@ -0,0 +1,10 @@ +typedef __SIZE_TYPE__ size_t; +void *malloc(size_t); +typedef union YYSTYPE { + char *id; +} YYSTYPE; +extern YYSTYPE yylval; +void yylex (int b) +{ + yylval = (YYSTYPE) (b ? 0 : (char *) malloc (4)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42716.c b/gcc/testsuite/gcc.c-torture/compile/pr42716.c new file mode 100644 index 000000000..e52df0f4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42716.c @@ -0,0 +1,18 @@ +static short foo (long long si1, short si2) +{ + return si1 > 0 && si2 > 0 || si1 < 0 + && si2 < 0 && si1 < 1 - si2 ? : si1 + si2; +} + +int g_13; +unsigned g_17; + +int safe (int, int); + +void bar (short p_51, short * p_52) +{ + int *const l_55 = &g_13; + if (safe (*p_52, g_13 != foo (*p_52 & *l_55 == g_13 && g_17 >= 1, 0))) + { + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42717.c b/gcc/testsuite/gcc.c-torture/compile/pr42717.c new file mode 100644 index 000000000..4fe6f93e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42717.c @@ -0,0 +1,30 @@ +static signed char +foo (signed char si1, unsigned char si2) +{ + return (si1 ^ si2) & (-si2 ^ si2) ? : si1 - si2; +} + +struct S0 +{ +}; + +unsigned char g_21; + +struct S0 g_34; + +void +bar (unsigned char p_20) +{ + unsigned char *l_22 = &g_21; + unsigned char l_23 = 0; + struct S0 *l = &g_34; + goto lbl_42; + for (; l_23; l_23 = foo (l_23, 1)) + { + for (p_20 = 0; 0; p_20 = foo (p_20, 1)) + lbl_42:; + (l == &g_34) ? 0 : ""; +lbl_85:*l_22 = p_20; + } + goto lbl_85; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42730.c b/gcc/testsuite/gcc.c-torture/compile/pr42730.c new file mode 100644 index 000000000..89aaafe87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42730.c @@ -0,0 +1,14 @@ +union bzz +{ + unsigned *pa; + void *pv; +}; + +void foo (void) +{ + union bzz u; + void **x; + void *y = 0; + x = &u.pv; + *x = y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42749.c b/gcc/testsuite/gcc.c-torture/compile/pr42749.c new file mode 100644 index 000000000..508c08720 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42749.c @@ -0,0 +1,5 @@ +struct pdf_object { int val; }; +int pdf_count_size_object (struct pdf_object * p_obj) +{ + return pdf_count_size_object(p_obj) + 2 * sizeof(struct pdf_object); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42927.c b/gcc/testsuite/gcc.c-torture/compile/pr42927.c new file mode 100644 index 000000000..ada919f70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42927.c @@ -0,0 +1,32 @@ +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef enum { READ_SHARED = 0, WRITE_EXCLUSIVE = 1, + READ_EXCLUSIVE = 2, EXCLUSIVE_ACCESS = 3 } scsires_access_mode; +struct scsires_extent_elem { + scsires_access_mode mode; + unsigned relative_address; + u_int32_t first_block; + u_int32_t length; +}; +typedef struct scsires_extent_elem scsires_extent_elem_t; +struct scsires_extent { + u_int8_t num_elements; + scsires_extent_elem_t *elements; +}; +typedef struct scsires_extent scsires_extent_t; +unsigned char buf[512]; +void scsires_issue_reservation(scsires_extent_t * new_extent) +{ + int i; + for (i = 0; i < new_extent->num_elements; i++) + { + buf[(i * 8)] = new_extent->elements[i].mode; + buf[(i * 8) + 1] = ((new_extent->elements[i].length >> 16) & 0xff); + buf[(i * 8) + 2] = ((new_extent->elements[i].length >> 8) & 0xff); + buf[(i * 8) + 3] = (new_extent->elements[i].length & 0xff); + buf[(i * 8) + 4] = ((new_extent->elements[i].first_block >> 24) & 0xff); + buf[(i * 8) + 5] = ((new_extent->elements[i].first_block >> 16) & 0xff); + buf[(i * 8) + 6] = ((new_extent->elements[i].first_block >> 8) & 0xff); + buf[(i * 8) + 7] = (new_extent->elements[i].first_block & 0xff); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42956.c b/gcc/testsuite/gcc.c-torture/compile/pr42956.c new file mode 100644 index 000000000..f592d4be4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42956.c @@ -0,0 +1,33 @@ +typedef const int cint; +typedef struct { +} Bounds; +int ndim_, ncomp_, selectedcomp_, nregions_; +void *voidregion_; +typedef struct { + double diff, err, spread; +} Errors; +typedef const Errors cErrors; +void Split(int iregion, int depth, int xregion) +{ + typedef struct { + double avg, err, spread, chisq; + double xmin[ndim_], xmax[ndim_]; + } Result; + typedef struct region { + Result result[ncomp_]; + } Region; + Errors errors[ncomp_]; + int comp, ireg, xreg; + for( ireg = iregion, xreg = xregion; ireg < nregions_; ireg = xreg++ ) + { + Result *result = ((Region *)voidregion_)[ireg].result; + for( comp = 0; comp < ncomp_; ++comp ) + { + Result *r = &result[comp]; + cErrors *e = &errors[comp]; + double c = e->diff; + if( r->err > 0 ) r->err = r->err*e->err + c; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42998.c b/gcc/testsuite/gcc.c-torture/compile/pr42998.c new file mode 100644 index 000000000..7506d1581 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42998.c @@ -0,0 +1,15 @@ +void foo(void *); +void bar(void *); +void ndisc_fill_addr_option(unsigned char *opt, int data_len, + unsigned short addr_type) +{ + int pad; + if (addr_type == 32) + pad = 2; + else + pad = 0; + __builtin_memset(opt + 2, 0, pad); + opt += pad; + __builtin_constant_p(data_len) ? foo (opt+2) : bar (opt+2); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43066.c b/gcc/testsuite/gcc.c-torture/compile/pr43066.c new file mode 100644 index 000000000..2ded9123e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43066.c @@ -0,0 +1,14 @@ +struct S { + struct { } empty[1]; + int i; +}; + +int foo(int i, ...) +{ + struct S s; + __builtin_va_list va; + __builtin_va_start(va, i); + s = __builtin_va_arg(va, struct S); + __builtin_va_end(va); + return s.i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43164.c b/gcc/testsuite/gcc.c-torture/compile/pr43164.c new file mode 100644 index 000000000..7e3e074bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43164.c @@ -0,0 +1,16 @@ +struct S0 +{ + unsigned char f0; + int:0; +}; + +struct S1 +{ + struct S0 f0; +}; + +struct S1 func_34 (void) +{ + struct S1 l_221 = { { 1 } }; + return l_221; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43186.c b/gcc/testsuite/gcc.c-torture/compile/pr43186.c new file mode 100644 index 000000000..7171e6ac0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43186.c @@ -0,0 +1,15 @@ +int n; + +void foo (int i) +{ + int a, b; + + if (!i) + for (a = 1; a < 4; a++) + if (a) + for (b = 1; b < 3; b++) + foo (b); + + n++; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43188.c b/gcc/testsuite/gcc.c-torture/compile/pr43188.c new file mode 100644 index 000000000..bbc6f422f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43188.c @@ -0,0 +1,6 @@ +int *__attribute__((__aligned__(16))) *p; + +int main (void) +{ + return **p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43191.c b/gcc/testsuite/gcc.c-torture/compile/pr43191.c new file mode 100644 index 000000000..f4ec0b477 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43191.c @@ -0,0 +1,47 @@ +/* { dg-skip-if "Ints are 16 bits" { "pdp11-*-*" } { "*" } { "" } } */ +struct S0 +{ +}; + +struct S1 +{ + unsigned f0:27; + const unsigned:0; +}; + +struct S2 +{ + unsigned f2:1; +}; + +unsigned char g_4[1][8][3][1][1][1]; +unsigned char *g_17; +unsigned char **g_16[1][10][7]; + +struct S2 g_35 = { + 0 +}; + +struct S2 *g_34 = &g_35; + +struct S1 func_86 (unsigned char p_87, struct S2 **p_89) +{ + struct S1 l_92[6][8][1][1] = { + 16143586 + } + ; + return l_92[0][0][0][0]; +} + +void func_28 (struct S1 p_30, const struct S1 p_32) +{ +} + +void func_70 (unsigned char p_72) +{ + unsigned char *const *l_93 = &g_17; + struct S2 **l_94; + unsigned char *const *l_97 = &g_17; + func_28 (func_86 (p_72, 0), + func_86 (p_72, &g_34)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43255.c b/gcc/testsuite/gcc.c-torture/compile/pr43255.c new file mode 100644 index 000000000..1b5384684 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43255.c @@ -0,0 +1,33 @@ +int safe (int); + +static unsigned foo (unsigned ui1, unsigned ui2) +{ + return ui1 + ui2; +} + +int g_22; +int *volatile g_23 = &g_22; +int **g_282[8][10][1]; +int *g_330 = &g_22; +volatile unsigned g_348; +int g_397; + +void int32func (const unsigned char p_10) +{ + if (foo + (~ + (p_10 | + (*g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10][g_348 % 1]) == + (*g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10][g_348 % 1])), + 1)) + { + } + else if (*g_330 >= + safe (*g_23 ^ + (**g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10] + [g_348 % 1])) & **g_282[8][10][1], 1) + { + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43288.c b/gcc/testsuite/gcc.c-torture/compile/pr43288.c new file mode 100644 index 000000000..73af0d9ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43288.c @@ -0,0 +1 @@ +static int a __attribute__ ((common)); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43367.c b/gcc/testsuite/gcc.c-torture/compile/pr43367.c new file mode 100644 index 000000000..5c620c13c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43367.c @@ -0,0 +1,30 @@ +unsigned char g_17; + +const unsigned char func_39 (unsigned char p_40, unsigned char * p_41) +{ + return 0; +} + +void int327 (const unsigned char p_48, unsigned char p_49) +{ + unsigned l_52; + unsigned char l_58[2]; + int i, j; + if (func_39 (l_52, &p_49), p_48) { + unsigned char *l_60; + unsigned char *l = &l_58[1]; + for (j; j; j++) { +lbl_59: + break; + } + for (l = 0; 1; l += 1) { + for (p_49 = 1; p_49; p_49 += 0) { + unsigned char **l_61[1][6]; + for (j = 0; j < 1; j++) + l_61[i][j] = &l_60; + goto lbl_59; + } + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43415.c b/gcc/testsuite/gcc.c-torture/compile/pr43415.c new file mode 100644 index 000000000..c00e1c41c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43415.c @@ -0,0 +1,36 @@ +int main() +{ + unsigned long long table[256]; + unsigned int i; + for (i=0; i<256; ++i) { + unsigned long long j; + unsigned char x=i; + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + table[i] ^= (((unsigned long long)x)<<16); + } + for (i=0; i<256; ++i) { + if ((table[i]&0xff)==i) + return 1; + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43614.c b/gcc/testsuite/gcc.c-torture/compile/pr43614.c new file mode 100644 index 000000000..411b25dac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43614.c @@ -0,0 +1,27 @@ +volatile int g_2[7]; + +void foo (unsigned); + +int main (void) +{ + int i_459 = 0; + int t2818; + int t2819; + volatile char *t2820; + int t2821; + volatile char *t2822; + int *t2823; + unsigned t2824; +LL655: + t2822 = (volatile char *)g_2; + t2821 = i_459; + t2820 = t2822 + t2821; + t2823 = (int *)t2820; + t2824 = *t2823; + foo (t2824); + t2818 = i_459; + t2819 = t2818 + 1; + i_459 = t2819; + goto LL655; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43635.c b/gcc/testsuite/gcc.c-torture/compile/pr43635.c new file mode 100644 index 000000000..4039fa7a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43635.c @@ -0,0 +1,7 @@ +extern void d (void); + +void (*foo (void)) (float) +{ + void (*(*x) (void)) (float) = d; + return (*x) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43636.c b/gcc/testsuite/gcc.c-torture/compile/pr43636.c new file mode 100644 index 000000000..ebf50edf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43636.c @@ -0,0 +1,10 @@ +/* PR target/43636 */ + +extern char a[], *b[]; + +char * +foo (char *x, int y) +{ + x = __builtin_stpcpy (x, b[a[y]]); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43661.c b/gcc/testsuite/gcc.c-torture/compile/pr43661.c new file mode 100644 index 000000000..1337e1df3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43661.c @@ -0,0 +1,5 @@ +int +func (int x) +{ + return 0 ? (unsigned short) (0 ? : 1 * (signed char) (x ^ x) >= 0) : 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43679.c b/gcc/testsuite/gcc.c-torture/compile/pr43679.c new file mode 100644 index 000000000..c45ef9f96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43679.c @@ -0,0 +1,33 @@ +unsigned g_5; +int g_7; +int g_23[2]; +int *g_29 = &g_23[0]; +int **g_59; +unsigned long g_186; + +int foo (int, int); +int bar (int); + +void func_37 (long p_38) +{ + int *l_39 = &g_7; + *l_39 = (*l_39 + || + (foo + (((*g_29 != *l_39, ((bar (g_59 != &l_39), 0), 0))), + 0))); + foo (*l_39, 0); + int **l_256 = &l_39; + { + for (0; g_186; 0) + { + *l_256 = *l_256; + if (g_5) + goto lbl_270; + *l_39 &= 0; + } + } +lbl_270: + ; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43791.c b/gcc/testsuite/gcc.c-torture/compile/pr43791.c new file mode 100644 index 000000000..38cb3c8e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43791.c @@ -0,0 +1,21 @@ +int owner(); +int clear(); + +static void fixup() { + clear(); +} + +inline __attribute__ ((always_inline)) +void slowtrylock(void) { + if (owner()) + fixup(); +} + +void fasttrylock(void (*slowfn)()) { + slowfn(); +} + +void trylock(void) { + fasttrylock(slowtrylock); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43845.c b/gcc/testsuite/gcc.c-torture/compile/pr43845.c new file mode 100644 index 000000000..bdb45e7d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43845.c @@ -0,0 +1,12 @@ +typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void); + +typedef struct { + x264_pixel_cmp_t ssd; +} x264_pixel_function_t; + +int x264_pixel_ssd_wxh (x264_pixel_function_t *pf, int i_width) { + int i_ssd = 0, x; + for (x = 0; x < i_width; x++) + i_ssd += pf->ssd(); + return i_ssd; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44030.c b/gcc/testsuite/gcc.c-torture/compile/pr44030.c new file mode 100644 index 000000000..cd5d5f616 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44030.c @@ -0,0 +1,28 @@ +typedef int int32_t; +typedef unsigned int uint32_t; +static uint32_t +safe_sub_func_uint32_t_u_u (uint32_t ui1, uint32_t ui2) +{ + return ui1 - ui2; +} + +int32_t l_105[7]; + +int32_t g_4; +int32_t *g_54 = &g_4; +int32_t * +func (int32_t p_73, int32_t * p_74, int32_t p_75, int32_t * *p_76, + int32_t * *p_77) +{ +lbl_110:for (g_4 = 0; g_4; g_4 = 1) + { + } + for (p_75 = -28; p_75; p_75 = safe_sub_func_uint32_t_u_u (p_75, 1)) + { + if (g_4) + goto lbl_110; + *g_54 = 0; + } + return &l_105[5]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44038.c b/gcc/testsuite/gcc.c-torture/compile/pr44038.c new file mode 100644 index 000000000..574ff398b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44038.c @@ -0,0 +1,13 @@ +struct Ustr { + char data[1]; +}; +int ustr_xi__embed_val_get(char *); +inline static int ustr_len(struct Ustr *s1) +{ + return ustr_xi__embed_val_get(s1->data); +} +static struct Ustr *s1 = ((struct Ustr *) ""); +int tst(char *cstr) +{ + return ustr_len(s1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44043.c b/gcc/testsuite/gcc.c-torture/compile/pr44043.c new file mode 100644 index 000000000..943501b40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44043.c @@ -0,0 +1,87 @@ +typedef unsigned char __u8; +typedef unsigned short __u16; +typedef unsigned int __u32; +typedef unsigned long __kernel_size_t; +typedef __kernel_size_t size_t; +typedef __u8 uint8_t; +typedef __u16 __be16; +typedef __u32 __be32; +struct msghdr { + struct iovec * msg_iov; + unsigned msg_flags; +}; +enum { IPPROTO_ICMP = 1 }; +struct sk_buff { }; +static inline __attribute__((always_inline)) struct dst_entry * +skb_dst(const struct sk_buff *skb) +{ +}; +enum nf_inet_hooks { NF_INET_LOCAL_OUT }; +struct net_device { + unsigned mtu; +}; +static inline __attribute__((always_inline)) int +NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct sk_buff *), int thresh) +{ + int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); + if (ret == 1) + ret = okfn(skb); + return ret; +} +static inline __attribute__((always_inline)) int +NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct sk_buff *)) +{ + return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, (-((int)(~0U>>1)) - 1)); +} +struct dst_entry { + struct net_device *dev; + int (*output)(struct sk_buff*); +}; +static inline __attribute__((always_inline)) int dst_output(struct sk_buff *skb) { + return skb_dst(skb)->output(skb); +}; +struct iphdr { + __u8 protocol; +}; +struct inet_sock { + __be16 inet_dport; + __u8 recverr: 1, hdrincl: 1; + struct { } cork; +}; +struct icmphdr { + __u8 type; +}; +struct rtable { + union { struct dst_entry dst; } u; + __be32 rt_dst; +}; +struct sock; +struct inet_sock *inet_sk (struct sock *); +struct net *sock_net (struct sock *); +void *skb_transport_header (struct sk_buff *); +static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, + struct rtable *rt, unsigned int flags) +{ + struct inet_sock *inet = inet_sk(sk); + struct net *net = sock_net(sk); + struct iphdr *iph; + struct sk_buff *skb; + if (length > rt->u.dst.dev->mtu) + ip_local_error(sk, 90, rt->rt_dst, inet->inet_dport, rt->u.dst.dev->mtu); + if (flags&0x10) + goto out; + if (iph->protocol == IPPROTO_ICMP) + icmp_out_count(net, ((struct icmphdr *)skb_transport_header(skb))->type); + NF_HOOK(2, NF_INET_LOCAL_OUT, skb, ((void *)0), rt->u.dst.dev, + dst_output); +out: + while (0); +} +int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) +{ + raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44063.c b/gcc/testsuite/gcc.c-torture/compile/pr44063.c new file mode 100644 index 000000000..596e1dc99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44063.c @@ -0,0 +1,38 @@ +typedef signed char int8_t; +typedef short int16_t; +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; + +union unaligned_32 {uint32_t l;} __attribute__((packed)) __attribute__((may_alias)); +static inline uint32_t NEG_USR32(uint32_t a, int8_t s){return a << (32 - s);} +typedef struct GetBitContext { const uint8_t *buffer, *buffer_end; int index;}GetBitContext; +typedef struct VLC {int16_t (*table)[2];} VLC; +static __attribute__((always_inline)) inline int get_vlc2(GetBitContext *s, int16_t (*table)[2], int bits, int max_depth) { + unsigned int re_index= (s)->index; + int re_cache= 0; + { + int n, nb_bits; + unsigned int index; + index= NEG_USR32(re_cache, bits); + n = table[index][1]; + if(max_depth > 1 && n < 0){ + re_cache= bswap_32((((const union unaligned_32 *) (((const uint8_t *)(s)->buffer)+(re_index>>3)))->l)) << (re_index&0x07); + } + } +} +typedef struct HYuvContext{GetBitContext gb; int decorrelate; int bitstream_bpp; uint8_t *temp[3]; VLC vlc[6];} HYuvContext; +static __attribute__((always_inline)) inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha){ + int i; + int code = get_vlc2(&s->gb, s->vlc[3].table, 11, 1); + if(code != -1){ + s->temp[0][4*i+0] = get_vlc2(&s->gb, s->vlc[0].table, 11, 3); + s->temp[0][4*i+1] = get_vlc2(&s->gb, s->vlc[1].table, 11, 3); + s->temp[0][4*i+2] = get_vlc2(&s->gb, s->vlc[2].table, 11, 3); + } +} +void decode_bgr_bitstream(HYuvContext *s, int count){ + if(s->decorrelate){ + if(s->bitstream_bpp==24) decode_bgr_1(s, count, 1, 0); + else decode_bgr_1(s, count, 1, 1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44119.c b/gcc/testsuite/gcc.c-torture/compile/pr44119.c new file mode 100644 index 000000000..ef6ca4533 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44119.c @@ -0,0 +1,46 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +static int8_t +safe_mul_func_int16_t_s_s (int16_t si1, int8_t si2) +{ + return si1 && si2 && si1 > +si2 || si1 && si2 && si2 < +si1 || si1 && si2 + && si1 < +si2 || si1 && si2 && si1 && si2 < +si1 ? : si1 * si2; +} + +struct S0 +{ +}; +int32_t g_72[7][4][1]; +int32_t *g_184 = &g_72[1][2][0]; +int32_t **g_224 = &g_184; +struct S0 g_244 = { +}; + +int8_t * +func_96 (int8_t p_97, uint32_t p_98, uint32_t p_99) +{ + struct S0 *l_243 = &g_244; + int i; + for (i = 0; i < 1; p_98 = 1) + { + int32_t *l_202[3]; + int i; + for (i = 0; i < 1; i++) + l_202[i] = &g_72[2][2][0]; + if (safe_mul_func_int16_t_s_s (0xCAF0, **g_224)) + { + if (p_98 && &l_243) + { + } + else + *g_224 = l_202[0]; + for (0;; 1) + { + } + } + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44197.c b/gcc/testsuite/gcc.c-torture/compile/pr44197.c new file mode 100644 index 000000000..9c2912ffc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44197.c @@ -0,0 +1,33 @@ +/* { dg-require-alias "" } */ +/* { dg-require-visibility "" } */ + +#ifndef __USER_LABEL_PREFIX__ +#define PREFIX "" +#else +#define xstr(s) str(s) +#define str(s) #s +#define PREFIX xstr(__USER_LABEL_PREFIX__) +#endif + +typedef unsigned short int __uint16_t; +enum +{ + _ISupper = (1 << (0)), _ISlower = (1 << (1)), _ISalpha = + (1 << (2)), _ISdigit = (1 << (3)), _ISxdigit = (1 << (4)), _ISspace = + (1 << (5)), _ISprint = (1 << (6)), _ISgraph = (1 << (7)), _ISblank = + (1 << (8)), _IScntrl = (1 << (9)), _ISpunct = (1 << (10)), _ISalnum = + (1 << (11)) +}; +typedef __uint16_t __ctype_mask_t; +extern const __ctype_mask_t *__C_ctype_b; +extern +__typeof (__C_ctype_b) + __C_ctype_b __asm__ (PREFIX "__GI___C_ctype_b") + __attribute__ ((visibility ("hidden"))); + static const __ctype_mask_t __C_ctype_b_data[] = { + }; + +const __ctype_mask_t *__C_ctype_b = __C_ctype_b_data + 128; +extern +__typeof (__C_ctype_b) + __EI___C_ctype_b __attribute__ ((alias ("" "__GI___C_ctype_b"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44246.c b/gcc/testsuite/gcc.c-torture/compile/pr44246.c new file mode 100644 index 000000000..6e4786903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44246.c @@ -0,0 +1,5 @@ +int main(int argc, char *argv[]) +{ + strcat(argv[0], "X"); + return strlen(argv[0]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44686.c b/gcc/testsuite/gcc.c-torture/compile/pr44686.c new file mode 100644 index 000000000..eacd83d31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44686.c @@ -0,0 +1,7 @@ +/* { dg-options "-O2 -fipa-pta -fprofile-generate" } */ +void * +memcpy (void *a, const void *b, __SIZE_TYPE__ len) +{ + if (a == b) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44687.c b/gcc/testsuite/gcc.c-torture/compile/pr44687.c new file mode 100644 index 000000000..f59c2efd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44687.c @@ -0,0 +1,32 @@ +typedef int int32_t; +typedef unsigned char uint8_t; +struct S0 +{ + uint8_t f0; +}; +struct S0 *g_18[7][5][1][1] = { +}; + +struct S0 **g_17 = &g_18[0][3][0][0]; +int32_t g_86; +struct S0 func_72 (uint8_t p_73, struct S0 p_74); + +void int326 (struct S0 **p_67, int32_t p_68, int32_t * *const p_69, + struct S0 *p_70) +{ + struct S0 l_95 = { + -1L + }; + func_72 (1L, func_72 (0, l_95)); +} + +struct S0 +func_72 (uint8_t p_73, struct S0 p_74) +{ + int32_t *l_85 = &g_86; + if (*l_85) + lbl_94:*l_85 ^= 0; + if (g_86) + goto lbl_94; + return **g_17; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44707.c b/gcc/testsuite/gcc.c-torture/compile/pr44707.c new file mode 100644 index 000000000..9031f0042 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44707.c @@ -0,0 +1,14 @@ +extern struct { int a, b, c, d; } v; +extern int w; + +void +foo (void) +{ + int e1 = v.a; + int e2 = w; + int e3 = v.b; + int e4 = v.c; + int e5 = v.d; + __asm__ volatile ("/* %0 %1 %2 %3 %4 */" : : "nro" (e1), "nro" (e2), "nro" (e3), "nro" (e4), "nro" (e5)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44784.c b/gcc/testsuite/gcc.c-torture/compile/pr44784.c new file mode 100644 index 000000000..54d531a3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44784.c @@ -0,0 +1,47 @@ +typedef struct rtx_def *rtx; +enum rtx_code { SUBREG }; +typedef union rtunion_def { + long rtint; + unsigned long rtuint; + rtx rtx; +} rtunion; +struct rtx_def { + enum rtx_code code: 8; + rtunion fld[1]; +}; +typedef struct simple_bitmap_def { + unsigned long long elms[1]; +} *sbitmap; +struct df_link { + struct df_link *next; + rtx reg; +}; +typedef enum { UNDEFINED, CONSTANT, VARYING } latticevalue; +typedef struct { + latticevalue lattice_val; +} value; +static value *values; +static sbitmap ssa_edges; +void defs_to_varying (struct df_link *start) +{ + struct df_link *currdef; + for (currdef = start; + currdef; + currdef = currdef->next) + { + rtx reg = currdef->reg; + if (values[(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint].lattice_val != VARYING) + ssa_edges->elms [(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint / 64] + |= ((unsigned long long) 1 + << (reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint % 64); + values[(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint].lattice_val = VARYING; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44788.c b/gcc/testsuite/gcc.c-torture/compile/pr44788.c new file mode 100644 index 000000000..99dc79823 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44788.c @@ -0,0 +1,8 @@ +void joint_decode(float* mlt_buffer1, int t) { + int i; + float decode_buffer[1060]; + foo(decode_buffer); + for (i=0; i<10 ; i++) { + mlt_buffer1[i] = i * decode_buffer[t]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44831.c b/gcc/testsuite/gcc.c-torture/compile/pr44831.c new file mode 100644 index 000000000..5539583de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44831.c @@ -0,0 +1,15 @@ +typedef unsigned char UCHAR, *PUCHAR; +typedef void *HANDLE; +typedef struct _NCB { + UCHAR ncb_reserve[10]; +} NCB, *PNCB; +struct NBCmdQueue { + PNCB head; +}; +PNCB *NBCmdQueueFindNBC(struct NBCmdQueue *queue, PNCB ncb) +{ + PNCB *ret = &queue->head; + while (ret && *ret != ncb) + ret = (PNCB *)((*ret)->ncb_reserve + sizeof(HANDLE)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44891.c b/gcc/testsuite/gcc.c-torture/compile/pr44891.c new file mode 100644 index 000000000..145b14469 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44891.c @@ -0,0 +1,26 @@ +struct S +{ + float f; + long l; +}; + +extern int gi; +extern float gf; + +long foo (long p) +{ + struct S s; + float *pf; + + s.l = p; + + pf = &s.f; + + pf++; + pf--; + + gf = *pf + 3.3; + gi = *((int *)pf) + 2; + + return s.l + 6; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44937.c b/gcc/testsuite/gcc.c-torture/compile/pr44937.c new file mode 100644 index 000000000..3bb711d7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44937.c @@ -0,0 +1,30 @@ +int g_19; +int *g_42; +int **volatile g = &g_42; +int g_67[5][9][2][1] = { +}; + +int +func_4 (int p_5, unsigned char p_6, unsigned char p_7) +{ + unsigned char l_8[1]; + if (p_6) + goto lbl_13; + for (p_6 = 0; p_6; p_6 = (p_6, 0)) + if (0) + { + } + else + lbl_13:for (p_6 = 0; p_6 < 1; p_6 += 1) + l_8[p_6] = 0; + return 0; +} + +int * +func_45 (unsigned long p_46, unsigned char p_47) +{ + int *l_56 = &g_19; + (void *)&l_56 != (void *)&g | !1 == func_4 (0, g_67[2][6][1][0], 0) ^ func_4 (1, 0, 0); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44941.c b/gcc/testsuite/gcc.c-torture/compile/pr44941.c new file mode 100644 index 000000000..7d9cc8372 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44941.c @@ -0,0 +1,8 @@ +struct S { }; + +extern void bar(struct S); + +void foo (int i) +{ + bar (*(struct S *)&i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44946.c b/gcc/testsuite/gcc.c-torture/compile/pr44946.c new file mode 100644 index 000000000..7b2301245 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44946.c @@ -0,0 +1,27 @@ +struct A +{ + int i; + long l; +}; + +struct B +{ + int i; +}; + +struct C +{ + int i; + struct B b; +}; + +struct B foo (struct A a) +{ + struct C *c = (struct C *) &a; + return c->b; +} +void bar (struct A a, struct B b) +{ + struct C *c = (struct C *) &a; + c->b = b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44988.c b/gcc/testsuite/gcc.c-torture/compile/pr44988.c new file mode 100644 index 000000000..317eafdf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44988.c @@ -0,0 +1,13 @@ +struct S +{ + int i; +}; + +extern void bar (struct S); + +void +foo (void) +{ + int i = 0; + bar (*(struct S *) &i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45047.c b/gcc/testsuite/gcc.c-torture/compile/pr45047.c new file mode 100644 index 000000000..f37955a03 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45047.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/45047 */ + +void +foo (const unsigned short *w, char *x, int y, int z) +{ + int i; + for (i = 0; i < y; i++) + x[i] = w[i] == z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45059.c b/gcc/testsuite/gcc.c-torture/compile/pr45059.c new file mode 100644 index 000000000..3f13cdbf8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45059.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/45059 */ + +typedef unsigned int T; +extern void foo (signed char *, int); + +static signed char a; +static T b[1] = { -1 }; +static unsigned char c; + +static inline short int +bar (short v) +{ + c |= a < b[0]; + return 0; +} + +int +main () +{ + signed char *e = &a; + foo (e, bar (bar (c))); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45085.c b/gcc/testsuite/gcc.c-torture/compile/pr45085.c new file mode 100644 index 000000000..5c1ec6a5c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45085.c @@ -0,0 +1,45 @@ +/* { dg-options "-O2 -Wuninitialized" } */ +struct S { char *s1; long s2; }; +struct T { int t1; long t2; long t3; }; +extern int fn2 (void); +extern int fn3 (struct T); +extern struct T fn4 (); +extern int fn5 (char **, long *, int); +extern void fn6 (void); +extern void fn7 (void *); +struct S *fn10 (); +static int p; +static void *q; +extern struct T r; + +static struct T +fn8 (struct T x, int y) +{ + struct S *u = fn10 (); + int v = fn5 (&u->s1, &u->s2, 0); + while (1) + { + if (p) +fn6 (); + if (fn3 (x)) +return fn4 (); + if (y & 1) +return r; + v = fn5 (&u->s1, &u->s2, 1); + } +} + +struct T +fn9 (struct T x, int y) +{ + struct T t = fn8 (x, y); + if (fn2 ()) + fn7 (q); + return t; +} + +void * +fn1 (void) +{ + return fn9; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45109.c b/gcc/testsuite/gcc.c-torture/compile/pr45109.c new file mode 100644 index 000000000..0e46c3840 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45109.c @@ -0,0 +1,38 @@ +struct o_fsm_t; +struct o_fsm_event_t; + +typedef void (*fn_t) (struct o_fsm_t *, + struct o_fsm_event_t const *); + +struct o_fsm_state_t { + fn_t dispatch; +}; + +struct o_fsm_t { + fn_t dispatch; +}; + +extern struct o_fsm_state_t o_fsm_tran(struct o_fsm_t *fsm, + struct o_fsm_state_t next_state); +static void plist_parser_state_start(struct o_fsm_t *fsm, + struct o_fsm_event_t const *fsm_event); + +struct o_fsm_state_t o_fsm_state(fn_t dispatch_fcn) +{ + return *(struct o_fsm_state_t *)&dispatch_fcn; +} + +typedef struct _o_plist_parser_t { + struct o_fsm_t fsm; +} o_plist_parser_t; + +static void plist_parser_state_start(struct o_fsm_t *fsm, + struct o_fsm_event_t const *fsm_event) +{ +} + +void o_plist_deserialize_xml(int fin) +{ + o_plist_parser_t parser; + o_fsm_tran(&parser.fsm, o_fsm_state(plist_parser_state_start)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45182.c b/gcc/testsuite/gcc.c-torture/compile/pr45182.c new file mode 100644 index 000000000..ad27ff886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45182.c @@ -0,0 +1,10 @@ +typedef struct TypHeader { + struct TypHeader ** ptr; +} *TypHandle; +void PlainRange (TypHandle hdList, long lenList, long low, long inc) +{ + long i; + for (i = 1; i <= lenList; i++ ) + (((TypHandle*)((hdList)->ptr))[i] = (((TypHandle) (((long)(low + (i-1) * +inc) << 2) + 1)))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45412.c b/gcc/testsuite/gcc.c-torture/compile/pr45412.c new file mode 100644 index 000000000..339854b59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45412.c @@ -0,0 +1,22 @@ +extern void baz (int, int, int); + +int j; + +int +bar (void) +{ + int n = 0, *np = &n; + if (j) + baz (0, 0, 0); + if (j) + baz (0, 0, 0); + return n; +} + +void +foo (void) +{ + bar (); + bar (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45535.c b/gcc/testsuite/gcc.c-torture/compile/pr45535.c new file mode 100644 index 000000000..03d15a12d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45535.c @@ -0,0 +1,38 @@ +typedef struct { + unsigned long pmd0; + unsigned long pmd1; +} pmd_t; +typedef unsigned int pgd_t; +struct mm_struct { + pgd_t * pgd; +}; +extern inline int pmd_bad(pmd_t pmd) +{ +} +extern inline void pmd_clear(pmd_t * pmdp) +{ + ((*pmdp).pmd0) = 0x20 | 0x00; + ((*pmdp).pmd1) = 0x20 | 0x00; +} +static inline void free_one_pmd(pmd_t * dir) +{ + if (pmd_bad(*dir)) { + pmd_clear(dir); + } +} +static inline void free_one_pgd(pgd_t * dir) +{ + int j; + pmd_t * pmd; + pmd = ((pmd_t *) ((unsigned long) (void *)(__pgd_val(dir) & (~((1UL << 12)-1)))) + (((0) >> 21) & (512 - 1))); + for (j = 0; j < 512 ; j++) { + free_one_pmd(pmd+j); + } +} +void clear_page_tables(struct mm_struct *mm, unsigned long first, int nr) +{ + pgd_t * page_dir = mm->pgd; + do { + free_one_pgd(page_dir); + } while (--nr); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45728.c b/gcc/testsuite/gcc.c-torture/compile/pr45728.c new file mode 100644 index 000000000..a6ee10b8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45728.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/45728 */ + +union U +{ + int *m; + double d; +}; + +int i; +union U u; + +int +foo (void) +{ + union U v = { &i }; + return u.d == v.d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45771.c b/gcc/testsuite/gcc.c-torture/compile/pr45771.c new file mode 100644 index 000000000..2bd96eccc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45771.c @@ -0,0 +1,7 @@ +static const int data[2048]; + +void foo (void *ptr) +{ + __builtin_memcmp (data, ptr, 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45876.c b/gcc/testsuite/gcc.c-torture/compile/pr45876.c new file mode 100644 index 000000000..a71be5fa8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45876.c @@ -0,0 +1,9 @@ +/* PR middle-end/45876 */ + +unsigned +foo (unsigned x) +{ + short i = 0; + i = ((short) (((((unsigned) i) >> 1) & 16383) + x)) & 16383; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45919.c b/gcc/testsuite/gcc.c-torture/compile/pr45919.c new file mode 100644 index 000000000..caf518db0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45919.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/45919 */ + +const struct S { int a; int b[]; } s = { 0, { 0 }}; + +int +foo (void) +{ + return s.b[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c b/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c new file mode 100644 index 000000000..ccf68bc49 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c @@ -0,0 +1,6 @@ +/* { dg-options "-std=c89" } */ +void crash() { + double l[4]; + if((l[0]+l[2]) && (l[1]+l[3])){ + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46002.c b/gcc/testsuite/gcc.c-torture/compile/pr46002.c new file mode 100644 index 000000000..27a3a3a28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46002.c @@ -0,0 +1,10 @@ +/* { dg-options "-fira-algorithm=priority" } */ +char ** +foo (char **p, char *cmp, unsigned i) +{ + for (; *p; p++) + if (__builtin_strncmp (*p, cmp, i)) + if (i == __builtin_strlen (*p)) + break; + return p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46034.c b/gcc/testsuite/gcc.c-torture/compile/pr46034.c new file mode 100644 index 000000000..02eda0572 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46034.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/46034 */ + +void bar (int); + +void +foo (int x, int y) +{ + int i; + for (i = 0; i < x; i++) + { + y = __builtin_abs (y); + bar (y / 2); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46107.c b/gcc/testsuite/gcc.c-torture/compile/pr46107.c new file mode 100644 index 000000000..41582b8a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46107.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/46107 */ + +int foo (void) __attribute__ ((noreturn)); + +void +bar (int x, int *y, int z) +{ + static void *j[] = { &&l1, &&l2 }; +l1: + if (*y) + goto *j[z]; + foo (); +l2: + *y ^= (x & 1) ? -1 : 0; + goto *j[x]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46248.c b/gcc/testsuite/gcc.c-torture/compile/pr46248.c new file mode 100644 index 000000000..6d3be2a65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46248.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/46248 */ + +struct S +{ + int s; +}; + +void +foo (unsigned char *x, int y, struct S *z) +{ + const int l1 = y; + const int l2 = y + l1; + const int l3 = y + l2; + const int l4 = y + l3; + const int l5 = y + l4; + const int l6 = y + l5; + const int l7 = y + l6; + int i; + for (i = 0; i < 8; i++) + { + int a = x[l3] - x[l4]; + int b = x[l4] - x[l5]; + int c = x[l5] - x[l6]; + int d = (b >= 0 ? b : -b) - (((a >= 0 ? a : -a) + (c >= 0 ? c : -c)) >> 1); + if (d < z->s * 2) + { + int v = d * (-b > 0 ? 1 : -1); + x[l2] += v >> 3; + x[l7] -= v >> 3; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46360.c b/gcc/testsuite/gcc.c-torture/compile/pr46360.c new file mode 100644 index 000000000..1a5239bc1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46360.c @@ -0,0 +1,13 @@ +/* PR middle-end/46360 */ + +__attribute__((gnu_inline, always_inline)) extern inline char * +strncpy (char *dest, const char *src, __SIZE_TYPE__ len) +{ + return __builtin_strncpy (dest, src, len); +} + +void +foo (char *s) +{ + strncpy (s, "", 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46388.c b/gcc/testsuite/gcc.c-torture/compile/pr46388.c new file mode 100644 index 000000000..74f60bb56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46388.c @@ -0,0 +1,14 @@ +/* PR middle-end/46388 */ + +struct S; +struct T +{ + struct S *t; +}; +extern struct S s, u; + +void +foo (void) +{ + ((struct T *) &u)->t = &s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46461.c b/gcc/testsuite/gcc.c-torture/compile/pr46461.c new file mode 100644 index 000000000..7e38598e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46461.c @@ -0,0 +1,8 @@ +/* PR tree-optimization/46461 */ + +void +foo (char *c) +{ + c[7] = 0xff; + __builtin_memset (c + 8, 0xff, 8); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46534.c b/gcc/testsuite/gcc.c-torture/compile/pr46534.c new file mode 100644 index 000000000..dc3c967cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46534.c @@ -0,0 +1,18 @@ +/* { dg-skip-if "too big" { pdp11-*-* } { "*" } { "" } } */ +/* PR middle-end/46534 */ + +extern int printf (const char *, ...); + +#define S1 " " +#define S2 S1 S1 S1 S1 S1 S1 S1 S1 S1 S1 +#define S3 S2 S2 S2 S2 S2 S2 S2 S2 S2 S2 +#define S4 S3 S3 S3 S3 S3 S3 S3 S3 S3 S3 +#define S5 S4 S4 S4 S4 S4 S4 S4 S4 S4 S4 +#define S6 S5 S5 S5 S5 S5 S5 S5 S5 S5 S5 +#define S7 S6 S6 S6 S6 S6 S6 S6 S6 S6 S6 + +void +foo (void) +{ + printf (S7 "\n"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46547-1.c b/gcc/testsuite/gcc.c-torture/compile/pr46547-1.c new file mode 100644 index 000000000..67d8e1e7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46547-1.c @@ -0,0 +1,6 @@ +void foo (void) { + _Bool d; + long double _Complex *s; + + d = *s++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46637.c b/gcc/testsuite/gcc.c-torture/compile/pr46637.c new file mode 100644 index 000000000..c765949e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46637.c @@ -0,0 +1,11 @@ +/* PR middle-end/46637 */ + +struct S { int s[5]; } *p; + +void +foo (long x) +{ + long a = x == 1 ? 4L : 1L; + asm ("" : "+m" (p->s[a])); + p->s[0]++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46832.c b/gcc/testsuite/gcc.c-torture/compile/pr46832.c new file mode 100644 index 000000000..f500aa510 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46832.c @@ -0,0 +1,4 @@ +double pow(double x, double y); +void foo( double x ) { + int j = (int) ((pow(x, 2)) < 0.0 ? (pow(x, 2))-0.5 : (pow(x, 2))+0.5); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46856.c b/gcc/testsuite/gcc.c-torture/compile/pr46856.c new file mode 100644 index 000000000..2ec5e8baf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46856.c @@ -0,0 +1,26 @@ +struct data { + int prio; + signed char status; +}; + +struct base { + unsigned _num; + struct data vec[10]; +}; + +static struct data *ix(struct base *base, unsigned i) +{ + return &base->vec[i]; +} + +struct heap { + struct base base; +}; + +struct heap *heap; + +void increase_insn_priority (int *fld, int amount) +{ + if (ix(heap ? &heap->base : 0, *fld)->status > 0) + ix(heap ? &heap->base : 0, *fld)->prio += amount; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46866.c b/gcc/testsuite/gcc.c-torture/compile/pr46866.c new file mode 100644 index 000000000..494114857 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46866.c @@ -0,0 +1,19 @@ +extern void *malloc(__SIZE_TYPE__); +typedef struct T T; +struct T { + void (*destroy)(void *); +}; +void destroy(union { void *this; } __attribute__((transparent_union))); +static const typeof(destroy) *_destroy = (const typeof(destroy)*)destroy; +void destroy(void *this); +static T *create_empty(void) +{ + T *this = malloc(sizeof(*this)); + *this = (typeof(*this)){ _destroy }; + return this; +} +void openssl_crl_load(void) +{ + T *this = create_empty(); + destroy(this); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46883.c b/gcc/testsuite/gcc.c-torture/compile/pr46883.c new file mode 100644 index 000000000..db8527d54 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46883.c @@ -0,0 +1,13 @@ +void bar (unsigned char *q, unsigned short *data16s, int len) +{ + int i; + + for (i = 0; i < len; i++) + { + q[2 * i] = + (((data16s[i] & 0xFF) << 8) | ((data16s[i] >> 8) & 0xFF)) & 0xFF; + q[2 * i + 1] = + ((unsigned short) + (((data16s[i] & 0xFF) << 8) | ((data16s[i] >> 8) & 0xFF))) >> 8; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47140.c b/gcc/testsuite/gcc.c-torture/compile/pr47140.c new file mode 100644 index 000000000..2adf53c20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47140.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/47140 */ + +static inline int +foo (int x, short y) +{ + return y == 0 ? x : x + y; +} + +static inline unsigned short +bar (unsigned short x, unsigned char y) +{ + return x - y; +} + +int w; + +int baz (void); + +int +test (void) +{ + int i; + for (i = 0; i < 50; i++) + w += foo ((unsigned char) (1 + baz ()) >= bar (0, 1), 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47141.c b/gcc/testsuite/gcc.c-torture/compile/pr47141.c new file mode 100644 index 000000000..875e0fdd1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47141.c @@ -0,0 +1,16 @@ +int +foo (__UINTPTR_TYPE__ x) +{ + int a = 6; + int *b = &a; + if (x) + for (a = 0; a; a++) + ; + return a; +} + +void +bar (void) +{ + foo ((__UINTPTR_TYPE__) foo); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47150.c b/gcc/testsuite/gcc.c-torture/compile/pr47150.c new file mode 100644 index 000000000..559ddd70f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47150.c @@ -0,0 +1,11 @@ +/* PR c/47150 */ + +float _Complex foo (float, float); + +void +bar () +{ + float w = 2; + float _Complex b; + b = 0.5 * (foo (0, w) + foo (1, w) / w); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47157.c b/gcc/testsuite/gcc.c-torture/compile/pr47157.c new file mode 100644 index 000000000..0947a5f9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47157.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/47157 */ + +struct S { unsigned a; unsigned b; } c = { 1, 0 }; +unsigned long int e; +void bar (int); +int baz (void); + +static int +foo (int x, short y) +{ + return ((x ^ y) & ((x ^ (x ^ y) & ~__INT_MAX__) - y ^ y)) < 0 ? x : x - y; +} + +void +test (void) +{ + bar (foo (baz () != (c.a | c.b), -1L)); + for (e = 0; e; e = 1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47265.c b/gcc/testsuite/gcc.c-torture/compile/pr47265.c new file mode 100644 index 000000000..183c3f986 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47265.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/47265 */ + +struct S +{ + char a[3]; + char b[3]; +}; + +void +bar (char *dst, const char *src, unsigned n) +{ + while (n--) + *dst++ = *src ? *src++ : ' '; +} + +void +foo (struct S *s) +{ + bar (s->a, s->b, 3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47427.c b/gcc/testsuite/gcc.c-torture/compile/pr47427.c new file mode 100644 index 000000000..4f0b98e20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47427.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/47427 */ + +char *g, *h; + +int +bar (unsigned char x, const int y) +{ +lab: + for (; h; g = h) + for (g = 0; h; h++) + { + int a = 1; + if (h) + { + if (a) + goto lab; + return y; + } + } + return x; +} + +void +foo (void) +{ + if (bar (0, 1)) + bar (1, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47428.c b/gcc/testsuite/gcc.c-torture/compile/pr47428.c new file mode 100644 index 000000000..0c4ccc912 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47428.c @@ -0,0 +1,42 @@ +/* PR tree-optimization/47428 */ + +struct S +{ + int s; +} a; +int b; + +void bar (struct S); + +int +baz (int x __attribute__((unused)), int y) +{ + int i; + for (i = 0; i < 1; i = 1) + for (y = 0; y < 1; y = 1); + return y; +} + +void +foo (void) +{ + fn (0); +} + +int +fn (const int x, int y __attribute__((unused))) +{ + if (baz (baz (0, x), 0)) + return 0; + else + bar (a); + return 0; +} + +void +bar (struct S x) +{ + for (;;) + for (; x.s;) + b = 0 ? : baz (0, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47967.c b/gcc/testsuite/gcc.c-torture/compile/pr47967.c new file mode 100644 index 000000000..cc2c21397 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47967.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/47967 */ + +extern void abort (void); +static void bar (); + +void +foo () +{ + bar (1); +} + +static void +bar (double i) +{ + if (i) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48161.c b/gcc/testsuite/gcc.c-torture/compile/pr48161.c new file mode 100644 index 000000000..c454efcd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48161.c @@ -0,0 +1,24 @@ +/* PR bootstrap/48161 */ + +struct T { int u; }; +struct G { int l; int t; int r; }; +struct V { struct G v[10]; }; +struct { struct V b; } *h; +void bar (void); + +struct G * +baz (struct V *x, unsigned y) +{ + return &x->v[y]; +} + +int +foo (struct T *x, struct T *y) +{ + if ((baz (&h->b, y->u)->t ? baz (&h->b, y->u)->t : 0) + - baz (h ? &h->b : 0, x->u)->r + - (baz (h ? &h->b : 0, x->u)->t > 0 ? 5 : 0)) + return 1; + bar (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c b/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c new file mode 100644 index 000000000..6f813382c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c @@ -0,0 +1,41 @@ +/* PR middle-end/48335 */ + +struct S { float d; }; + +void bar (struct S); + +void +f0 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[0] = x; + s.d *= 7.0; + bar (s); +} + +void +f1 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[1] = x; + s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[2] = x; + s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[3] = x; + s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48517.c b/gcc/testsuite/gcc.c-torture/compile/pr48517.c new file mode 100644 index 000000000..30b3ecbb3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48517.c @@ -0,0 +1,13 @@ +/* PR c/48517 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void bar (const unsigned short *); + +void +foo (void) +{ + static const unsigned short array[] = (const unsigned short []) { 0x0D2B }; + const unsigned short *ptr = array; + bar (ptr); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48734.c b/gcc/testsuite/gcc.c-torture/compile/pr48734.c new file mode 100644 index 000000000..b20ea80fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48734.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/48734 */ + +unsigned int +foo (int x, unsigned int y, unsigned int z) +{ + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + return z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48742.c b/gcc/testsuite/gcc.c-torture/compile/pr48742.c new file mode 100644 index 000000000..0a670f3c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48742.c @@ -0,0 +1,15 @@ +/* PR c/48742 */ + +void baz (int); + +int +foo (void) +{ + return 1 / 0 > 0; +} + +void +bar (void) +{ + baz (1 <= 2 % (3 >> 1 > 5 / 6 == 3)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49029.c b/gcc/testsuite/gcc.c-torture/compile/pr49029.c new file mode 100644 index 000000000..ebe81b31b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49029.c @@ -0,0 +1,10 @@ +/* PR middle-end/49029 */ +struct S { volatile unsigned f : 11; signed g : 30; } __attribute__((packed)); +struct T { volatile struct S h; } __attribute__((packed)) a; +void foo (int); + +void +bar () +{ + foo (a.h.g); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49049.c b/gcc/testsuite/gcc.c-torture/compile/pr49049.c new file mode 100644 index 000000000..a24b2a41c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49049.c @@ -0,0 +1,28 @@ +__extension__ typedef unsigned long long int uint64_t; + +static int +sub (int a, int b) +{ + return a - b; +} + +static uint64_t +add (uint64_t a, uint64_t b) +{ + return a + b; +} + +int *ptr; + +int +foo (uint64_t arg1, int *arg2) +{ + int j; + for (; j < 1; j++) + { + *arg2 |= sub ( sub (sub (j || 1 ^ 0x1, 1), arg1 < 0x1 <= + sub (1, *ptr & j)), + (sub ( j != 1 || sub (j && j, 1) >= 0, + add (!j > arg1, 0x35DLL)))); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49238.c b/gcc/testsuite/gcc.c-torture/compile/pr49238.c new file mode 100644 index 000000000..fd8443a8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49238.c @@ -0,0 +1,18 @@ +/* PR target/49238 */ +extern int bar (void); + +void +foo (unsigned long long a, int b) +{ + int i; + + if (b) + for (a = -12; a >= 10; a = bar ()) + break; + else + return; + + for (i = 0; i < 10; i += 10) + if ((i == bar ()) | (bar () >= a)) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c b/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c new file mode 100644 index 000000000..cdaad294f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c @@ -0,0 +1,4 @@ +struct s { char p[2]; }; +static struct s v; +const int o0 = (int) ((void *) &v.p[0] - (void *) &v) + 0U; +const int o1 = (int) ((void *) &v.p[0] - (void *) &v) + 1U; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c b/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c new file mode 100644 index 000000000..2d30e8802 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c @@ -0,0 +1,4 @@ +struct s { char p[2]; }; +static struct s v; +const int o0 = (int) ((void *) &v.p[0] - (void *) &v) + 0; +const int o1 = (int) ((void *) &v.p[0] - (void *) &v) + 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51077.c b/gcc/testsuite/gcc.c-torture/compile/pr51077.c new file mode 100644 index 000000000..de2b97e58 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr51077.c @@ -0,0 +1,15 @@ +/* PR middle-end/51077 */ + +struct S { unsigned char s, t[256]; }; + +void +foo (const struct S *x, struct S *y, int z) +{ + int i; + for (i = 0; i < 8; i++) + { + const struct S *a = &x[i]; + __builtin___memcpy_chk (y->t, a->t, z, __builtin_object_size (y->t, 0)); + y = (struct S *) &y->t[z]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51767.c b/gcc/testsuite/gcc.c-torture/compile/pr51767.c new file mode 100644 index 000000000..62a192d66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr51767.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/51767 */ + +extern void fn1 (void), fn2 (void); + +static inline __attribute__((always_inline)) int +foo (int *x, long y) +{ + asm goto ("" : : "r" (x), "r" (y) : "memory" : lab); + return 0; +lab: + return 1; +} + +void +bar (int *x) +{ + if (foo (x, 23)) + fn1 (); + else + fn2 (); + + foo (x, 2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52074.c b/gcc/testsuite/gcc.c-torture/compile/pr52074.c new file mode 100644 index 000000000..92a2096f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr52074.c @@ -0,0 +1,10 @@ +/* PR middle-end/52074 */ + +struct S { const char *d, *e; } __attribute__((packed)); + +void +foo (const char **p, struct S *q) +{ + *p = "abcdef"; + q->d = "ghijk"; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c new file mode 100644 index 000000000..721b02d78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c @@ -0,0 +1,5 @@ +void +f (void) +{ + int i = (0 ? 1 : 0U / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c new file mode 100644 index 000000000..a437b6a0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c @@ -0,0 +1,5 @@ +void +f (void) +{ + int i = (1 ? 0U / 0 : 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-1.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-1.c new file mode 100644 index 000000000..d941f3e1f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-1.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 || 0 / 0 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-2.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-2.c new file mode 100644 index 000000000..4bd624965 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-2.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 / 0 || 0 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-3.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-3.c new file mode 100644 index 000000000..9be0b94ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-3.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 1 && 0 / 0 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-4.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-4.c new file mode 100644 index 000000000..89ce24cd9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-4.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 / 0 && 1 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-5.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-5.c new file mode 100644 index 000000000..9594b2895 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-5.c @@ -0,0 +1,5 @@ +void +f (void) +{ + !(0 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-6.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-6.c new file mode 100644 index 000000000..2b0b0baa9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-6.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 || 65536*65536 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54552-1.c b/gcc/testsuite/gcc.c-torture/compile/pr54552-1.c new file mode 100644 index 000000000..bc20053a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54552-1.c @@ -0,0 +1,8 @@ +void +f (void) +{ + unsigned n = 10; + + typedef double T[n]; + (double (*)[n])((unsigned char (*)[sizeof (T)]){ 0 }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr56539.c b/gcc/testsuite/gcc.c-torture/compile/pr56539.c new file mode 100644 index 000000000..0fba96f4c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr56539.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/56539 */ + +short +foo (const char *x, unsigned y) +{ + return y > 1 ? (x[y - 1] - '0') + 10 * foo (x, y - 1) : (*x - '0'); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pta-1.c b/gcc/testsuite/gcc.c-torture/compile/pta-1.c new file mode 100644 index 000000000..515e5ff13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pta-1.c @@ -0,0 +1,31 @@ +typedef struct JSObject JSObject; +typedef struct JSObjectMap *(*JSNewObjectMapOp) (JSObject *obj); +typedef JSObject *(*JSGetMethodOp) (JSObject *obj); +struct JSObjectOps { + JSNewObjectMapOp newObjectMap; +}; +struct JSXMLObjectOps { + struct JSObjectOps base; + JSGetMethodOp getMethod; +}; +struct JSObjectMap { + struct JSObjectOps *ops; +}; +struct JSObject { + struct JSObjectMap *map; +}; + +struct JSXMLObjectOps js_XMLObjectOps; + + +/* We need to create SFT's for the entire structure when this address is taken, + not just the part in the component reference itself. */ +JSObject *JS_GetMethod(JSObject *obj) +{ + if (obj->map->ops == &js_XMLObjectOps.base) { + struct JSXMLObjectOps *ops; + ops = (struct JSXMLObjectOps *) obj->map->ops; + obj = ops->getMethod(obj); + } + return obj; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c b/gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c new file mode 100644 index 000000000..11dc8ce89 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c @@ -0,0 +1,11 @@ +/* The intermediate conversion to __PTRDIFF_TYPE__ could be lost, + resulting in an "invalid types in nop conversion" ICE. */ +long long a; +void +f (void) +{ + int c = 1; + volatile int *p = &c; + a = (long long) (__PTRDIFF_TYPE__) p; + *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-1.c b/gcc/testsuite/gcc.c-torture/compile/simd-1.c new file mode 100644 index 000000000..6a07bbb6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-1.c @@ -0,0 +1,7 @@ +typedef int v2si __attribute__ ((vector_size (8))); +typedef unsigned di __attribute__ ((mode(DI))); +void foo(unsigned long); +void bar() { + v2si x = { 1, 2 }; + foo((di) x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-2.c b/gcc/testsuite/gcc.c-torture/compile/simd-2.c new file mode 100644 index 000000000..480c712c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-2.c @@ -0,0 +1,17 @@ +typedef float floatvect2 __attribute__((vector_size (8))); + +typedef union +{ + floatvect2 vector; + float f[2]; +}resfloatvect2; + +void tempf(float *x, float *y) +{ + floatvect2 temp={x[0],x[1]}; + floatvect2 temp1={y[0],y[1]}; + resfloatvect2 temp2; + temp2.vector=temp+temp1; + x[0]=temp2.f[0]; + x[1]=temp2.f[1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-3.c b/gcc/testsuite/gcc.c-torture/compile/simd-3.c new file mode 100644 index 000000000..42a38ae56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-3.c @@ -0,0 +1,23 @@ +#include <float.h> + +/* If double is not wider than float, we probably don't have DFmode, + or at least it's not as wide as double. */ +#if DBL_MANT_DIG > FLT_MANT_DIG +typedef double floatvect2 __attribute__((vector_size (16))); + +typedef union +{ + floatvect2 vector; + double f[2]; +}resfloatvect2; + +void tempf(double *x, double *y) +{ + floatvect2 temp={x[0],x[1]}; + floatvect2 temp1={y[0],y[1]}; + resfloatvect2 temp2; + temp2.vector=temp+temp1; + x[0]=temp2.f[0]; + x[1]=temp2.f[1]; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-4.c b/gcc/testsuite/gcc.c-torture/compile/simd-4.c new file mode 100644 index 000000000..6329fc096 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-4.c @@ -0,0 +1,15 @@ +typedef float floatvect2 __attribute__((vector_size (16))); + +typedef union +{ + floatvect2 vector; + float f[2]; +}resfloatvect2; + +void tempf(floatvect2 *x, floatvect2 *y) +{ + floatvect2 temp= *x; + floatvect2 temp1=*y; + resfloatvect2 temp2; + *x=temp+temp1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.c b/gcc/testsuite/gcc.c-torture/compile/simd-5.c new file mode 100644 index 000000000..016cccd1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-5.c @@ -0,0 +1,12 @@ +#define vector64 __attribute__((vector_size(8))) + +main(){ + + vector64 int c; +vector64 int a = {1, -1}; +vector64 int b = {2, -2}; +c = -a + b*b*(-1LL); +/* c is now {5, 3} */ + + printf("result is %llx\n", (long long)c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-6.c b/gcc/testsuite/gcc.c-torture/compile/simd-6.c new file mode 100644 index 000000000..7998e152f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-6.c @@ -0,0 +1,3 @@ +typedef int __attribute__((vector_size (8))) vec; + +vec a[] = {(vec) {1, 2}, {3, 4}}; diff --git a/gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c b/gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c new file mode 100644 index 000000000..80618cc8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c @@ -0,0 +1,15 @@ +/* This checks the gcc builtin macros defined to the byte + sizes of C standard types. */ + +int a[sizeof(int) == __SIZEOF_INT__ ? 1 : -1]; +int b[sizeof(long) == __SIZEOF_LONG__ ? 1 : -1]; +int c[sizeof(long long) == __SIZEOF_LONG_LONG__ ? 1 : -1]; +int d[sizeof(short) == __SIZEOF_SHORT__ ? 1 : -1]; +int e[sizeof(void *) == __SIZEOF_POINTER__ ? 1 : -1]; +int f[sizeof(float) == __SIZEOF_FLOAT__ ? 1 : -1]; +int g[sizeof(double) == __SIZEOF_DOUBLE__ ? 1 : -1]; +int h[sizeof(long double) == __SIZEOF_LONG_DOUBLE__ ? 1 : -1]; +int i[sizeof(__SIZE_TYPE__) == __SIZEOF_SIZE_T__ ? 1 : -1]; +int j[sizeof(__WCHAR_TYPE__) == __SIZEOF_WCHAR_T__ ? 1 : -1]; +int k[sizeof(__WINT_TYPE__) == __SIZEOF_WINT_T__ ? 1 : -1]; +int l[sizeof(__PTRDIFF_TYPE__) == __SIZEOF_PTRDIFF_T__ ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/sra-1.c b/gcc/testsuite/gcc.c-torture/compile/sra-1.c new file mode 100644 index 000000000..06dcf1002 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sra-1.c @@ -0,0 +1,75 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* Let gimple verifier check what SRA does to unions and single-field + strucutres . */ + +struct sim_struct +{ + int x; +}; + +extern struct sim_struct get_x(void); + +struct sim_struct foo (void) +{ + struct sim_struct simple; + + simple = get_x (); + if (simple.x % 2) + simple.x = 39; + else + simple.x -=8; + + return simple; +} + +struct sim_cmplx +{ + _Complex double c; +}; + +extern struct sim_cmplx get_sc (void); + +_Complex double foo_c (void) +{ + struct sim_cmplx simple; + + simple = get_sc (); + if (__real__ simple.c > 200.3) + __imag__ simple.c -= 2.4; + + return simple.c; +} + + +union sim_union +{ + int i; + float d; +}; + +extern union sim_union get_y (void); + +union sim_union bar (void) +{ + union sim_union simple; + + simple = get_y (); + if (simple.d > 8.2) + simple.i = 300; + + return simple; +} + +extern int get_int (void); + +int bar_i (void) +{ + union sim_union simple; + + simple = get_y (); + if (simple.d > 8.2) + simple.i = get_int (); + + return simple.i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c b/gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c new file mode 100644 index 000000000..eda370d4b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c @@ -0,0 +1,19 @@ +void washQtoM3(double m[9], double q[4]); +double sqrt(double); +int f(int samp) +{ + double clp[2], xyz[3], q[4], len; + double mRF[9]; + int xi; + for (xi=0; xi<samp; xi++) + { + q[0] = 1.0; + q[1] = ( ((double)(1)-(-1))*((double)((float)xi)-(-0.5)) / ((double)(samp-0.5)-(-0.5)) + (-1)); + q[2] = ( ((double)(1)-(-1))*((double)((float)0)-(-0.5)) / ((double)(samp-0.5)-(-0.5)) + (-1)); + q[3] = ( ((double)(1)-(-1))*((double)((float)0)-(-0.5)) / ((double)(samp-0.5)-(-0.5)) + (-1)); + len = (sqrt((((q))[0]*((q))[0] + ((q))[1]*((q))[1] + ((q))[2]*((q))[2] + ((q))[3]*((q))[3]))); + ((q)[0] = (q)[0]*1.0/len, (q)[1] = (q)[1]*1.0/len, (q)[2] = (q)[2]*1.0/len, (q)[3] = (q)[3]*1.0/len); + washQtoM3(mRF, q); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/statement-expression-1.c b/gcc/testsuite/gcc.c-torture/compile/statement-expression-1.c new file mode 100644 index 000000000..fb4860256 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/statement-expression-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/30253, We would ICE with statement expressions + in a conditional expression because we forgot to update the wrapper + function for the gimple modify statement. */ + +#define f(x) ({ unsigned tmp=x; tmp; }) + +unsigned foo(unsigned x) { + return __builtin_constant_p(x) ? 0 : f(x); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/strcpy-1.c b/gcc/testsuite/gcc.c-torture/compile/strcpy-1.c new file mode 100644 index 000000000..2c7b16a08 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/strcpy-1.c @@ -0,0 +1,15 @@ + + +typedef struct +{ + char str[20]; +}STACK; +STACK stack[15]; +int level; +rezero () +{ + level = 0; + __builtin_strcpy (stack[level].str, ""); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/strcpy-2.c b/gcc/testsuite/gcc.c-torture/compile/strcpy-2.c new file mode 100644 index 000000000..075cdd1f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/strcpy-2.c @@ -0,0 +1,7 @@ +char wrkstr_un[270]; +extern void +LoadUserAlph (char *s) +{ + s = &wrkstr_un[0]; + __builtin_strcpy (s, ""); +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c new file mode 100644 index 000000000..0924f5cc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c @@ -0,0 +1,7 @@ +/* Bug c/17855. */ +struct foo {char x, y, z[2];}; +struct foo f(); +void bar(int baz) +{ + f().z[baz] = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c new file mode 100644 index 000000000..daa0d1749 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c @@ -0,0 +1,7 @@ +/* Bug c/17855, using conditional expression for non-lvalue. */ +struct foo {char x, y, z[2];}; +struct foo p, q; int r; +void bar(int baz) +{ + (r ? p : q).z[baz] = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c new file mode 100644 index 000000000..3020194ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c @@ -0,0 +1,7 @@ +/* Bug c/17855, using assignment for non-lvalue. */ +struct foo {char x, y, z[2];}; +struct foo p, q; +void bar(int baz) +{ + (p = q).z[baz] = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/structs.c b/gcc/testsuite/gcc.c-torture/compile/structs.c new file mode 100644 index 000000000..8e5566d81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/structs.c @@ -0,0 +1,263 @@ +/* Copyright 1996, 1999, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + <http://www.gnu.org/licenses/>. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +struct struct1 { char a;}; +struct struct2 { char a, b;}; +struct struct3 { char a, b, c; }; +struct struct4 { char a, b, c, d; }; +struct struct5 { char a, b, c, d, e; }; +struct struct6 { char a, b, c, d, e, f; }; +struct struct7 { char a, b, c, d, e, f, g; }; +struct struct8 { char a, b, c, d, e, f, g, h; }; +struct struct9 { char a, b, c, d, e, f, g, h, i; }; +struct struct10 { char a, b, c, d, e, f, g, h, i, j; }; +struct struct11 { char a, b, c, d, e, f, g, h, i, j, k; }; +struct struct12 { char a, b, c, d, e, f, g, h, i, j, k, l; }; +struct struct16 { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p; }; + +struct struct1 foo1 = {'1'}, L1; +struct struct2 foo2 = { 'a', 'b'}, L2; +struct struct3 foo3 = { 'A', 'B', 'C'}, L3; +struct struct4 foo4 = {'1', '2', '3', '4'}, L4; +struct struct5 foo5 = {'a', 'b', 'c', 'd', 'e'}, L5; +struct struct6 foo6 = {'A', 'B', 'C', 'D', 'E', 'F'}, L6; +struct struct7 foo7 = {'1', '2', '3', '4', '5', '6', '7'}, L7; +struct struct8 foo8 = {'1', '2', '3', '4', '5', '6', '7', '8'}, L8; +struct struct9 foo9 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}, L9; +struct struct10 foo10 = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}, L10; +struct struct11 foo11 = { + '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, L11; +struct struct12 foo12 = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'}, L12; +struct struct16 foo16 = { + 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'}, L16; + +struct struct1 fun1() +{ + return foo1; +} +struct struct2 fun2() +{ + return foo2; +} +struct struct3 fun3() +{ + return foo3; +} +struct struct4 fun4() +{ + return foo4; +} +struct struct5 fun5() +{ + return foo5; +} +struct struct6 fun6() +{ + return foo6; +} +struct struct7 fun7() +{ + return foo7; +} +struct struct8 fun8() +{ + return foo8; +} +struct struct9 fun9() +{ + return foo9; +} +struct struct10 fun10() +{ + return foo10; +} +struct struct11 fun11() +{ + return foo11; +} +struct struct12 fun12() +{ + return foo12; +} +struct struct16 fun16() +{ + return foo16; +} + +#ifdef PROTOTYPES +void Fun1(struct struct1 foo1) +#else +void Fun1(foo1) + struct struct1 foo1; +#endif +{ + L1 = foo1; +} +#ifdef PROTOTYPES +void Fun2(struct struct2 foo2) +#else +void Fun2(foo2) + struct struct2 foo2; +#endif +{ + L2 = foo2; +} +#ifdef PROTOTYPES +void Fun3(struct struct3 foo3) +#else +void Fun3(foo3) + struct struct3 foo3; +#endif +{ + L3 = foo3; +} +#ifdef PROTOTYPES +void Fun4(struct struct4 foo4) +#else +void Fun4(foo4) + struct struct4 foo4; +#endif +{ + L4 = foo4; +} +#ifdef PROTOTYPES +void Fun5(struct struct5 foo5) +#else +void Fun5(foo5) + struct struct5 foo5; +#endif +{ + L5 = foo5; +} +#ifdef PROTOTYPES +void Fun6(struct struct6 foo6) +#else +void Fun6(foo6) + struct struct6 foo6; +#endif +{ + L6 = foo6; +} +#ifdef PROTOTYPES +void Fun7(struct struct7 foo7) +#else +void Fun7(foo7) + struct struct7 foo7; +#endif +{ + L7 = foo7; +} +#ifdef PROTOTYPES +void Fun8(struct struct8 foo8) +#else +void Fun8(foo8) + struct struct8 foo8; +#endif +{ + L8 = foo8; +} +#ifdef PROTOTYPES +void Fun9(struct struct9 foo9) +#else +void Fun9(foo9) + struct struct9 foo9; +#endif +{ + L9 = foo9; +} +#ifdef PROTOTYPES +void Fun10(struct struct10 foo10) +#else +void Fun10(foo10) + struct struct10 foo10; +#endif +{ + L10 = foo10; +} +#ifdef PROTOTYPES +void Fun11(struct struct11 foo11) +#else +void Fun11(foo11) + struct struct11 foo11; +#endif +{ + L11 = foo11; +} +#ifdef PROTOTYPES +void Fun12(struct struct12 foo12) +#else +void Fun12(foo12) + struct struct12 foo12; +#endif +{ + L12 = foo12; +} +#ifdef PROTOTYPES +void Fun16(struct struct16 foo16) +#else +void Fun16(foo16) + struct struct16 foo16; +#endif +{ + L16 = foo16; +} + +int main() +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + + /* TEST C FUNCTIONS */ + L1 = fun1(); + L2 = fun2(); + L3 = fun3(); + L4 = fun4(); + L5 = fun5(); + L6 = fun6(); + L7 = fun7(); + L8 = fun8(); + L9 = fun9(); + L10 = fun10(); + L11 = fun11(); + L12 = fun12(); + L16 = fun16(); + + foo1.a = foo2.a = foo3.a = foo4.a = foo5.a = foo6.a = foo7.a = foo8.a = + foo9.a = foo10.a = foo11.a = foo12.a = foo16.a = '$'; + + Fun1(foo1); + Fun2(foo2); + Fun3(foo3); + Fun4(foo4); + Fun5(foo5); + Fun6(foo6); + Fun7(foo7); + Fun8(foo8); + Fun9(foo9); + Fun10(foo10); + Fun11(foo11); + Fun12(foo12); + Fun16(foo16); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/switch-1.c b/gcc/testsuite/gcc.c-torture/compile/switch-1.c new file mode 100644 index 000000000..cc71d30bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/switch-1.c @@ -0,0 +1,9 @@ +/* PR middle-end/26557. */ +const int struct_test[1] = {1}; +void g(); +void f() { + switch(struct_test[0]) { + case 1: g(); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-1.c b/gcc/testsuite/gcc.c-torture/compile/sync-1.c new file mode 100644 index 000000000..0354923d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sync-1.c @@ -0,0 +1,279 @@ +/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ +/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +/* Validate that each of the __sync builtins compiles. This won't + necessarily link, since the target might not support the builtin, + so this may result in external library calls. */ + +signed char sc; +unsigned char uc; +signed short ss; +unsigned short us; +signed int si; +unsigned int ui; +signed long sl; +unsigned long ul; +signed long long sll; +unsigned long long ull; +void *vp; +int *ip; +struct S { struct S *next; int x; } *sp; + +void test_op_ignore (void) +{ + (void) __sync_fetch_and_add (&sc, 1); + (void) __sync_fetch_and_add (&uc, 1); + (void) __sync_fetch_and_add (&ss, 1); + (void) __sync_fetch_and_add (&us, 1); + (void) __sync_fetch_and_add (&si, 1); + (void) __sync_fetch_and_add (&ui, 1); + (void) __sync_fetch_and_add (&sl, 1); + (void) __sync_fetch_and_add (&ul, 1); + (void) __sync_fetch_and_add (&sll, 1); + (void) __sync_fetch_and_add (&ull, 1); + + (void) __sync_fetch_and_sub (&sc, 1); + (void) __sync_fetch_and_sub (&uc, 1); + (void) __sync_fetch_and_sub (&ss, 1); + (void) __sync_fetch_and_sub (&us, 1); + (void) __sync_fetch_and_sub (&si, 1); + (void) __sync_fetch_and_sub (&ui, 1); + (void) __sync_fetch_and_sub (&sl, 1); + (void) __sync_fetch_and_sub (&ul, 1); + (void) __sync_fetch_and_sub (&sll, 1); + (void) __sync_fetch_and_sub (&ull, 1); + + (void) __sync_fetch_and_or (&sc, 1); + (void) __sync_fetch_and_or (&uc, 1); + (void) __sync_fetch_and_or (&ss, 1); + (void) __sync_fetch_and_or (&us, 1); + (void) __sync_fetch_and_or (&si, 1); + (void) __sync_fetch_and_or (&ui, 1); + (void) __sync_fetch_and_or (&sl, 1); + (void) __sync_fetch_and_or (&ul, 1); + (void) __sync_fetch_and_or (&sll, 1); + (void) __sync_fetch_and_or (&ull, 1); + + (void) __sync_fetch_and_xor (&sc, 1); + (void) __sync_fetch_and_xor (&uc, 1); + (void) __sync_fetch_and_xor (&ss, 1); + (void) __sync_fetch_and_xor (&us, 1); + (void) __sync_fetch_and_xor (&si, 1); + (void) __sync_fetch_and_xor (&ui, 1); + (void) __sync_fetch_and_xor (&sl, 1); + (void) __sync_fetch_and_xor (&ul, 1); + (void) __sync_fetch_and_xor (&sll, 1); + (void) __sync_fetch_and_xor (&ull, 1); + + (void) __sync_fetch_and_and (&sc, 1); + (void) __sync_fetch_and_and (&uc, 1); + (void) __sync_fetch_and_and (&ss, 1); + (void) __sync_fetch_and_and (&us, 1); + (void) __sync_fetch_and_and (&si, 1); + (void) __sync_fetch_and_and (&ui, 1); + (void) __sync_fetch_and_and (&sl, 1); + (void) __sync_fetch_and_and (&ul, 1); + (void) __sync_fetch_and_and (&sll, 1); + (void) __sync_fetch_and_and (&ull, 1); + + (void) __sync_fetch_and_nand (&sc, 1); + (void) __sync_fetch_and_nand (&uc, 1); + (void) __sync_fetch_and_nand (&ss, 1); + (void) __sync_fetch_and_nand (&us, 1); + (void) __sync_fetch_and_nand (&si, 1); + (void) __sync_fetch_and_nand (&ui, 1); + (void) __sync_fetch_and_nand (&sl, 1); + (void) __sync_fetch_and_nand (&ul, 1); + (void) __sync_fetch_and_nand (&sll, 1); + (void) __sync_fetch_and_nand (&ull, 1); +} + +void test_fetch_and_op (void) +{ + sc = __sync_fetch_and_add (&sc, 11); + uc = __sync_fetch_and_add (&uc, 11); + ss = __sync_fetch_and_add (&ss, 11); + us = __sync_fetch_and_add (&us, 11); + si = __sync_fetch_and_add (&si, 11); + ui = __sync_fetch_and_add (&ui, 11); + sl = __sync_fetch_and_add (&sl, 11); + ul = __sync_fetch_and_add (&ul, 11); + sll = __sync_fetch_and_add (&sll, 11); + ull = __sync_fetch_and_add (&ull, 11); + + sc = __sync_fetch_and_sub (&sc, 11); + uc = __sync_fetch_and_sub (&uc, 11); + ss = __sync_fetch_and_sub (&ss, 11); + us = __sync_fetch_and_sub (&us, 11); + si = __sync_fetch_and_sub (&si, 11); + ui = __sync_fetch_and_sub (&ui, 11); + sl = __sync_fetch_and_sub (&sl, 11); + ul = __sync_fetch_and_sub (&ul, 11); + sll = __sync_fetch_and_sub (&sll, 11); + ull = __sync_fetch_and_sub (&ull, 11); + + sc = __sync_fetch_and_or (&sc, 11); + uc = __sync_fetch_and_or (&uc, 11); + ss = __sync_fetch_and_or (&ss, 11); + us = __sync_fetch_and_or (&us, 11); + si = __sync_fetch_and_or (&si, 11); + ui = __sync_fetch_and_or (&ui, 11); + sl = __sync_fetch_and_or (&sl, 11); + ul = __sync_fetch_and_or (&ul, 11); + sll = __sync_fetch_and_or (&sll, 11); + ull = __sync_fetch_and_or (&ull, 11); + + sc = __sync_fetch_and_xor (&sc, 11); + uc = __sync_fetch_and_xor (&uc, 11); + ss = __sync_fetch_and_xor (&ss, 11); + us = __sync_fetch_and_xor (&us, 11); + si = __sync_fetch_and_xor (&si, 11); + ui = __sync_fetch_and_xor (&ui, 11); + sl = __sync_fetch_and_xor (&sl, 11); + ul = __sync_fetch_and_xor (&ul, 11); + sll = __sync_fetch_and_xor (&sll, 11); + ull = __sync_fetch_and_xor (&ull, 11); + + sc = __sync_fetch_and_and (&sc, 11); + uc = __sync_fetch_and_and (&uc, 11); + ss = __sync_fetch_and_and (&ss, 11); + us = __sync_fetch_and_and (&us, 11); + si = __sync_fetch_and_and (&si, 11); + ui = __sync_fetch_and_and (&ui, 11); + sl = __sync_fetch_and_and (&sl, 11); + ul = __sync_fetch_and_and (&ul, 11); + sll = __sync_fetch_and_and (&sll, 11); + ull = __sync_fetch_and_and (&ull, 11); + + sc = __sync_fetch_and_nand (&sc, 11); + uc = __sync_fetch_and_nand (&uc, 11); + ss = __sync_fetch_and_nand (&ss, 11); + us = __sync_fetch_and_nand (&us, 11); + si = __sync_fetch_and_nand (&si, 11); + ui = __sync_fetch_and_nand (&ui, 11); + sl = __sync_fetch_and_nand (&sl, 11); + ul = __sync_fetch_and_nand (&ul, 11); + sll = __sync_fetch_and_nand (&sll, 11); + ull = __sync_fetch_and_nand (&ull, 11); +} + +void test_op_and_fetch (void) +{ + sc = __sync_add_and_fetch (&sc, uc); + uc = __sync_add_and_fetch (&uc, uc); + ss = __sync_add_and_fetch (&ss, uc); + us = __sync_add_and_fetch (&us, uc); + si = __sync_add_and_fetch (&si, uc); + ui = __sync_add_and_fetch (&ui, uc); + sl = __sync_add_and_fetch (&sl, uc); + ul = __sync_add_and_fetch (&ul, uc); + sll = __sync_add_and_fetch (&sll, uc); + ull = __sync_add_and_fetch (&ull, uc); + + sc = __sync_sub_and_fetch (&sc, uc); + uc = __sync_sub_and_fetch (&uc, uc); + ss = __sync_sub_and_fetch (&ss, uc); + us = __sync_sub_and_fetch (&us, uc); + si = __sync_sub_and_fetch (&si, uc); + ui = __sync_sub_and_fetch (&ui, uc); + sl = __sync_sub_and_fetch (&sl, uc); + ul = __sync_sub_and_fetch (&ul, uc); + sll = __sync_sub_and_fetch (&sll, uc); + ull = __sync_sub_and_fetch (&ull, uc); + + sc = __sync_or_and_fetch (&sc, uc); + uc = __sync_or_and_fetch (&uc, uc); + ss = __sync_or_and_fetch (&ss, uc); + us = __sync_or_and_fetch (&us, uc); + si = __sync_or_and_fetch (&si, uc); + ui = __sync_or_and_fetch (&ui, uc); + sl = __sync_or_and_fetch (&sl, uc); + ul = __sync_or_and_fetch (&ul, uc); + sll = __sync_or_and_fetch (&sll, uc); + ull = __sync_or_and_fetch (&ull, uc); + + sc = __sync_xor_and_fetch (&sc, uc); + uc = __sync_xor_and_fetch (&uc, uc); + ss = __sync_xor_and_fetch (&ss, uc); + us = __sync_xor_and_fetch (&us, uc); + si = __sync_xor_and_fetch (&si, uc); + ui = __sync_xor_and_fetch (&ui, uc); + sl = __sync_xor_and_fetch (&sl, uc); + ul = __sync_xor_and_fetch (&ul, uc); + sll = __sync_xor_and_fetch (&sll, uc); + ull = __sync_xor_and_fetch (&ull, uc); + + sc = __sync_and_and_fetch (&sc, uc); + uc = __sync_and_and_fetch (&uc, uc); + ss = __sync_and_and_fetch (&ss, uc); + us = __sync_and_and_fetch (&us, uc); + si = __sync_and_and_fetch (&si, uc); + ui = __sync_and_and_fetch (&ui, uc); + sl = __sync_and_and_fetch (&sl, uc); + ul = __sync_and_and_fetch (&ul, uc); + sll = __sync_and_and_fetch (&sll, uc); + ull = __sync_and_and_fetch (&ull, uc); + + sc = __sync_nand_and_fetch (&sc, uc); + uc = __sync_nand_and_fetch (&uc, uc); + ss = __sync_nand_and_fetch (&ss, uc); + us = __sync_nand_and_fetch (&us, uc); + si = __sync_nand_and_fetch (&si, uc); + ui = __sync_nand_and_fetch (&ui, uc); + sl = __sync_nand_and_fetch (&sl, uc); + ul = __sync_nand_and_fetch (&ul, uc); + sll = __sync_nand_and_fetch (&sll, uc); + ull = __sync_nand_and_fetch (&ull, uc); +} + +void test_compare_and_swap (void) +{ + sc = __sync_val_compare_and_swap (&sc, uc, sc); + uc = __sync_val_compare_and_swap (&uc, uc, sc); + ss = __sync_val_compare_and_swap (&ss, uc, sc); + us = __sync_val_compare_and_swap (&us, uc, sc); + si = __sync_val_compare_and_swap (&si, uc, sc); + ui = __sync_val_compare_and_swap (&ui, uc, sc); + sl = __sync_val_compare_and_swap (&sl, uc, sc); + ul = __sync_val_compare_and_swap (&ul, uc, sc); + sll = __sync_val_compare_and_swap (&sll, uc, sc); + ull = __sync_val_compare_and_swap (&ull, uc, sc); + + ui = __sync_bool_compare_and_swap (&sc, uc, sc); + ui = __sync_bool_compare_and_swap (&uc, uc, sc); + ui = __sync_bool_compare_and_swap (&ss, uc, sc); + ui = __sync_bool_compare_and_swap (&us, uc, sc); + ui = __sync_bool_compare_and_swap (&si, uc, sc); + ui = __sync_bool_compare_and_swap (&ui, uc, sc); + ui = __sync_bool_compare_and_swap (&sl, uc, sc); + ui = __sync_bool_compare_and_swap (&ul, uc, sc); + ui = __sync_bool_compare_and_swap (&sll, uc, sc); + ui = __sync_bool_compare_and_swap (&ull, uc, sc); +} + +void test_lock (void) +{ + sc = __sync_lock_test_and_set (&sc, 1); + uc = __sync_lock_test_and_set (&uc, 1); + ss = __sync_lock_test_and_set (&ss, 1); + us = __sync_lock_test_and_set (&us, 1); + si = __sync_lock_test_and_set (&si, 1); + ui = __sync_lock_test_and_set (&ui, 1); + sl = __sync_lock_test_and_set (&sl, 1); + ul = __sync_lock_test_and_set (&ul, 1); + sll = __sync_lock_test_and_set (&sll, 1); + ull = __sync_lock_test_and_set (&ull, 1); + + __sync_synchronize (); + + __sync_lock_release (&sc); + __sync_lock_release (&uc); + __sync_lock_release (&ss); + __sync_lock_release (&us); + __sync_lock_release (&si); + __sync_lock_release (&ui); + __sync_lock_release (&sl); + __sync_lock_release (&ul); + __sync_lock_release (&sll); + __sync_lock_release (&ull); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-2.c b/gcc/testsuite/gcc.c-torture/compile/sync-2.c new file mode 100644 index 000000000..bdc84ef0a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sync-2.c @@ -0,0 +1,168 @@ +/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +/* Validate that each of the __sync builtins compiles. This won't + necessarily link, since the target might not support the builtin, + so this may result in external library calls. */ + +signed char sc; +unsigned char uc; +signed short ss; +unsigned short us; +signed int si; +unsigned int ui; +signed long sl; +unsigned long ul; +signed long long sll; +unsigned long long ull; + +void test_op_ignore (void) +{ + (void) __sync_fetch_and_add (&sc, -1); + (void) __sync_fetch_and_add (&uc, -1); + (void) __sync_fetch_and_add (&ss, -1); + (void) __sync_fetch_and_add (&us, -1); + (void) __sync_fetch_and_add (&si, -1); + (void) __sync_fetch_and_add (&ui, -1); + (void) __sync_fetch_and_add (&sl, -1); + (void) __sync_fetch_and_add (&ul, -1); + (void) __sync_fetch_and_add (&sll, -1); + (void) __sync_fetch_and_add (&ull, -1); + + (void) __sync_fetch_and_sub (&sc, -1); + (void) __sync_fetch_and_sub (&uc, -1); + (void) __sync_fetch_and_sub (&ss, -1); + (void) __sync_fetch_and_sub (&us, -1); + (void) __sync_fetch_and_sub (&si, -1); + (void) __sync_fetch_and_sub (&ui, -1); + (void) __sync_fetch_and_sub (&sl, -1); + (void) __sync_fetch_and_sub (&ul, -1); + (void) __sync_fetch_and_sub (&sll, -1); + (void) __sync_fetch_and_sub (&ull, -1); + + (void) __sync_fetch_and_or (&sc, -1); + (void) __sync_fetch_and_or (&uc, -1); + (void) __sync_fetch_and_or (&ss, -1); + (void) __sync_fetch_and_or (&us, -1); + (void) __sync_fetch_and_or (&si, -1); + (void) __sync_fetch_and_or (&ui, -1); + (void) __sync_fetch_and_or (&sl, -1); + (void) __sync_fetch_and_or (&ul, -1); + (void) __sync_fetch_and_or (&sll, -1); + (void) __sync_fetch_and_or (&ull, -1); + + (void) __sync_fetch_and_xor (&sc, -1); + (void) __sync_fetch_and_xor (&uc, -1); + (void) __sync_fetch_and_xor (&ss, -1); + (void) __sync_fetch_and_xor (&us, -1); + (void) __sync_fetch_and_xor (&si, -1); + (void) __sync_fetch_and_xor (&ui, -1); + (void) __sync_fetch_and_xor (&sl, -1); + (void) __sync_fetch_and_xor (&ul, -1); + (void) __sync_fetch_and_xor (&sll, -1); + (void) __sync_fetch_and_xor (&ull, -1); + + (void) __sync_fetch_and_and (&sc, -1); + (void) __sync_fetch_and_and (&uc, -1); + (void) __sync_fetch_and_and (&ss, -1); + (void) __sync_fetch_and_and (&us, -1); + (void) __sync_fetch_and_and (&si, -1); + (void) __sync_fetch_and_and (&ui, -1); + (void) __sync_fetch_and_and (&sl, -1); + (void) __sync_fetch_and_and (&ul, -1); + (void) __sync_fetch_and_and (&sll, -1); + (void) __sync_fetch_and_and (&ull, -1); + + (void) __sync_fetch_and_nand (&sc, -1); + (void) __sync_fetch_and_nand (&uc, -1); + (void) __sync_fetch_and_nand (&ss, -1); + (void) __sync_fetch_and_nand (&us, -1); + (void) __sync_fetch_and_nand (&si, -1); + (void) __sync_fetch_and_nand (&ui, -1); + (void) __sync_fetch_and_nand (&sl, -1); + (void) __sync_fetch_and_nand (&ul, -1); + (void) __sync_fetch_and_nand (&sll, -1); + (void) __sync_fetch_and_nand (&ull, -1); +} + +void test_fetch_and_op (void) +{ + sc = __sync_fetch_and_add (&sc, -11); + uc = __sync_fetch_and_add (&uc, -11); + ss = __sync_fetch_and_add (&ss, -11); + us = __sync_fetch_and_add (&us, -11); + si = __sync_fetch_and_add (&si, -11); + ui = __sync_fetch_and_add (&ui, -11); + sl = __sync_fetch_and_add (&sl, -11); + ul = __sync_fetch_and_add (&ul, -11); + sll = __sync_fetch_and_add (&sll, -11); + ull = __sync_fetch_and_add (&ull, -11); + + sc = __sync_fetch_and_sub (&sc, -11); + uc = __sync_fetch_and_sub (&uc, -11); + ss = __sync_fetch_and_sub (&ss, -11); + us = __sync_fetch_and_sub (&us, -11); + si = __sync_fetch_and_sub (&si, -11); + ui = __sync_fetch_and_sub (&ui, -11); + sl = __sync_fetch_and_sub (&sl, -11); + ul = __sync_fetch_and_sub (&ul, -11); + sll = __sync_fetch_and_sub (&sll, -11); + ull = __sync_fetch_and_sub (&ull, -11); + + sc = __sync_fetch_and_or (&sc, -11); + uc = __sync_fetch_and_or (&uc, -11); + ss = __sync_fetch_and_or (&ss, -11); + us = __sync_fetch_and_or (&us, -11); + si = __sync_fetch_and_or (&si, -11); + ui = __sync_fetch_and_or (&ui, -11); + sl = __sync_fetch_and_or (&sl, -11); + ul = __sync_fetch_and_or (&ul, -11); + sll = __sync_fetch_and_or (&sll, -11); + ull = __sync_fetch_and_or (&ull, -11); + + sc = __sync_fetch_and_xor (&sc, -11); + uc = __sync_fetch_and_xor (&uc, -11); + ss = __sync_fetch_and_xor (&ss, -11); + us = __sync_fetch_and_xor (&us, -11); + si = __sync_fetch_and_xor (&si, -11); + ui = __sync_fetch_and_xor (&ui, -11); + sl = __sync_fetch_and_xor (&sl, -11); + ul = __sync_fetch_and_xor (&ul, -11); + sll = __sync_fetch_and_xor (&sll, -11); + ull = __sync_fetch_and_xor (&ull, -11); + + sc = __sync_fetch_and_and (&sc, -11); + uc = __sync_fetch_and_and (&uc, -11); + ss = __sync_fetch_and_and (&ss, -11); + us = __sync_fetch_and_and (&us, -11); + si = __sync_fetch_and_and (&si, -11); + ui = __sync_fetch_and_and (&ui, -11); + sl = __sync_fetch_and_and (&sl, -11); + ul = __sync_fetch_and_and (&ul, -11); + sll = __sync_fetch_and_and (&sll, -11); + ull = __sync_fetch_and_and (&ull, -11); + + sc = __sync_fetch_and_nand (&sc, -11); + uc = __sync_fetch_and_nand (&uc, -11); + ss = __sync_fetch_and_nand (&ss, -11); + us = __sync_fetch_and_nand (&us, -11); + si = __sync_fetch_and_nand (&si, -11); + ui = __sync_fetch_and_nand (&ui, -11); + sl = __sync_fetch_and_nand (&sl, -11); + ul = __sync_fetch_and_nand (&ul, -11); + sll = __sync_fetch_and_nand (&sll, -11); + ull = __sync_fetch_and_nand (&ull, -11); +} + +void test_lock (void) +{ + sc = __sync_lock_test_and_set (&sc, -1); + uc = __sync_lock_test_and_set (&uc, -1); + ss = __sync_lock_test_and_set (&ss, -1); + us = __sync_lock_test_and_set (&us, -1); + si = __sync_lock_test_and_set (&si, -1); + ui = __sync_lock_test_and_set (&ui, -1); + sl = __sync_lock_test_and_set (&sl, -1); + ul = __sync_lock_test_and_set (&ul, -1); + sll = __sync_lock_test_and_set (&sll, -1); + ull = __sync_lock_test_and_set (&ull, -1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-3.c b/gcc/testsuite/gcc.c-torture/compile/sync-3.c new file mode 100644 index 000000000..9689eea5b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sync-3.c @@ -0,0 +1,187 @@ +/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +/* Validate that each of the __sync builtins compiles. This won't + necessarily link, since the target might not support the builtin, + so this may result in external library calls. */ + +void test_op_ignore (void) +{ +signed char sc[2]; +unsigned char uc[2]; +signed short ss[2]; +unsigned short us[2]; +signed int si[2]; +unsigned int ui[2]; +signed long sl[2]; +unsigned long ul[2]; +signed long long sll[2]; +unsigned long long ull[2]; + (void) __sync_fetch_and_add (&sc[1], -1); + (void) __sync_fetch_and_add (&uc[1], -1); + (void) __sync_fetch_and_add (&ss[1], -1); + (void) __sync_fetch_and_add (&us[1], -1); + (void) __sync_fetch_and_add (&si[1], -1); + (void) __sync_fetch_and_add (&ui[1], -1); + (void) __sync_fetch_and_add (&sl[1], -1); + (void) __sync_fetch_and_add (&ul[1], -1); + (void) __sync_fetch_and_add (&sll[1], -1); + (void) __sync_fetch_and_add (&ull[1], -1); + + (void) __sync_fetch_and_sub (&sc[1], -1); + (void) __sync_fetch_and_sub (&uc[1], -1); + (void) __sync_fetch_and_sub (&ss[1], -1); + (void) __sync_fetch_and_sub (&us[1], -1); + (void) __sync_fetch_and_sub (&si[1], -1); + (void) __sync_fetch_and_sub (&ui[1], -1); + (void) __sync_fetch_and_sub (&sl[1], -1); + (void) __sync_fetch_and_sub (&ul[1], -1); + (void) __sync_fetch_and_sub (&sll[1], -1); + (void) __sync_fetch_and_sub (&ull[1], -1); + + (void) __sync_fetch_and_or (&sc[1], -1); + (void) __sync_fetch_and_or (&uc[1], -1); + (void) __sync_fetch_and_or (&ss[1], -1); + (void) __sync_fetch_and_or (&us[1], -1); + (void) __sync_fetch_and_or (&si[1], -1); + (void) __sync_fetch_and_or (&ui[1], -1); + (void) __sync_fetch_and_or (&sl[1], -1); + (void) __sync_fetch_and_or (&ul[1], -1); + (void) __sync_fetch_and_or (&sll[1], -1); + (void) __sync_fetch_and_or (&ull[1], -1); + + (void) __sync_fetch_and_xor (&sc[1], -1); + (void) __sync_fetch_and_xor (&uc[1], -1); + (void) __sync_fetch_and_xor (&ss[1], -1); + (void) __sync_fetch_and_xor (&us[1], -1); + (void) __sync_fetch_and_xor (&si[1], -1); + (void) __sync_fetch_and_xor (&ui[1], -1); + (void) __sync_fetch_and_xor (&sl[1], -1); + (void) __sync_fetch_and_xor (&ul[1], -1); + (void) __sync_fetch_and_xor (&sll[1], -1); + (void) __sync_fetch_and_xor (&ull[1], -1); + + (void) __sync_fetch_and_and (&sc[1], -1); + (void) __sync_fetch_and_and (&uc[1], -1); + (void) __sync_fetch_and_and (&ss[1], -1); + (void) __sync_fetch_and_and (&us[1], -1); + (void) __sync_fetch_and_and (&si[1], -1); + (void) __sync_fetch_and_and (&ui[1], -1); + (void) __sync_fetch_and_and (&sl[1], -1); + (void) __sync_fetch_and_and (&ul[1], -1); + (void) __sync_fetch_and_and (&sll[1], -1); + (void) __sync_fetch_and_and (&ull[1], -1); + + (void) __sync_fetch_and_nand (&sc[1], -1); + (void) __sync_fetch_and_nand (&uc[1], -1); + (void) __sync_fetch_and_nand (&ss[1], -1); + (void) __sync_fetch_and_nand (&us[1], -1); + (void) __sync_fetch_and_nand (&si[1], -1); + (void) __sync_fetch_and_nand (&ui[1], -1); + (void) __sync_fetch_and_nand (&sl[1], -1); + (void) __sync_fetch_and_nand (&ul[1], -1); + (void) __sync_fetch_and_nand (&sll[1], -1); + (void) __sync_fetch_and_nand (&ull[1], -1); +} + +void test_fetch_and_op (void) +{ +signed char sc[2]; +unsigned char uc[2]; +signed short ss[2]; +unsigned short us[2]; +signed int si[2]; +unsigned int ui[2]; +signed long sl[2]; +unsigned long ul[2]; +signed long long sll[2]; +unsigned long long ull[2]; + sc[1] = __sync_fetch_and_add (&sc[1], -11); + uc[1] = __sync_fetch_and_add (&uc[1], -11); + ss[1] = __sync_fetch_and_add (&ss[1], -11); + us[1] = __sync_fetch_and_add (&us[1], -11); + si[1] = __sync_fetch_and_add (&si[1], -11); + ui[1] = __sync_fetch_and_add (&ui[1], -11); + sl[1] = __sync_fetch_and_add (&sl[1], -11); + ul[1] = __sync_fetch_and_add (&ul[1], -11); + sll[1] = __sync_fetch_and_add (&sll[1], -11); + ull[1] = __sync_fetch_and_add (&ull[1], -11); + + sc[1] = __sync_fetch_and_sub (&sc[1], -11); + uc[1] = __sync_fetch_and_sub (&uc[1], -11); + ss[1] = __sync_fetch_and_sub (&ss[1], -11); + us[1] = __sync_fetch_and_sub (&us[1], -11); + si[1] = __sync_fetch_and_sub (&si[1], -11); + ui[1] = __sync_fetch_and_sub (&ui[1], -11); + sl[1] = __sync_fetch_and_sub (&sl[1], -11); + ul[1] = __sync_fetch_and_sub (&ul[1], -11); + sll[1] = __sync_fetch_and_sub (&sll[1], -11); + ull[1] = __sync_fetch_and_sub (&ull[1], -11); + + sc[1] = __sync_fetch_and_or (&sc[1], -11); + uc[1] = __sync_fetch_and_or (&uc[1], -11); + ss[1] = __sync_fetch_and_or (&ss[1], -11); + us[1] = __sync_fetch_and_or (&us[1], -11); + si[1] = __sync_fetch_and_or (&si[1], -11); + ui[1] = __sync_fetch_and_or (&ui[1], -11); + sl[1] = __sync_fetch_and_or (&sl[1], -11); + ul[1] = __sync_fetch_and_or (&ul[1], -11); + sll[1] = __sync_fetch_and_or (&sll[1], -11); + ull[1] = __sync_fetch_and_or (&ull[1], -11); + + sc[1] = __sync_fetch_and_xor (&sc[1], -11); + uc[1] = __sync_fetch_and_xor (&uc[1], -11); + ss[1] = __sync_fetch_and_xor (&ss[1], -11); + us[1] = __sync_fetch_and_xor (&us[1], -11); + si[1] = __sync_fetch_and_xor (&si[1], -11); + ui[1] = __sync_fetch_and_xor (&ui[1], -11); + sl[1] = __sync_fetch_and_xor (&sl[1], -11); + ul[1] = __sync_fetch_and_xor (&ul[1], -11); + sll[1] = __sync_fetch_and_xor (&sll[1], -11); + ull[1] = __sync_fetch_and_xor (&ull[1], -11); + + sc[1] = __sync_fetch_and_and (&sc[1], -11); + uc[1] = __sync_fetch_and_and (&uc[1], -11); + ss[1] = __sync_fetch_and_and (&ss[1], -11); + us[1] = __sync_fetch_and_and (&us[1], -11); + si[1] = __sync_fetch_and_and (&si[1], -11); + ui[1] = __sync_fetch_and_and (&ui[1], -11); + sl[1] = __sync_fetch_and_and (&sl[1], -11); + ul[1] = __sync_fetch_and_and (&ul[1], -11); + sll[1] = __sync_fetch_and_and (&sll[1], -11); + ull[1] = __sync_fetch_and_and (&ull[1], -11); + + sc[1] = __sync_fetch_and_nand (&sc[1], -11); + uc[1] = __sync_fetch_and_nand (&uc[1], -11); + ss[1] = __sync_fetch_and_nand (&ss[1], -11); + us[1] = __sync_fetch_and_nand (&us[1], -11); + si[1] = __sync_fetch_and_nand (&si[1], -11); + ui[1] = __sync_fetch_and_nand (&ui[1], -11); + sl[1] = __sync_fetch_and_nand (&sl[1], -11); + ul[1] = __sync_fetch_and_nand (&ul[1], -11); + sll[1] = __sync_fetch_and_nand (&sll[1], -11); + ull[1] = __sync_fetch_and_nand (&ull[1], -11); +} + +void test_lock (void) +{ +signed char sc[2]; +unsigned char uc[2]; +signed short ss[2]; +unsigned short us[2]; +signed int si[2]; +unsigned int ui[2]; +signed long sl[2]; +unsigned long ul[2]; +signed long long sll[2]; +unsigned long long ull[2]; + sc[1] = __sync_lock_test_and_set (&sc[1], -1); + uc[1] = __sync_lock_test_and_set (&uc[1], -1); + ss[1] = __sync_lock_test_and_set (&ss[1], -1); + us[1] = __sync_lock_test_and_set (&us[1], -1); + si[1] = __sync_lock_test_and_set (&si[1], -1); + ui[1] = __sync_lock_test_and_set (&ui[1], -1); + sl[1] = __sync_lock_test_and_set (&sl[1], -1); + ul[1] = __sync_lock_test_and_set (&ul[1], -1); + sll[1] = __sync_lock_test_and_set (&sll[1], -1); + ull[1] = __sync_lock_test_and_set (&ull[1], -1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c b/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c new file mode 100644 index 000000000..29d6ed0dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c @@ -0,0 +1,14 @@ +/* Sparc w/128-bit long double bombed on this because even though + the trunctfdf libcall passed the long double by reference, the + libcall was still marked as LCT_CONST instead of LCT_PURE. */ + +double *copy(long double *first, long double *last, double *result) +{ + int n; + for (n = last - first; n > 0; --n) { + *result = *first; + ++first; + ++result; + } + return result; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-1.c b/gcc/testsuite/gcc.c-torture/compile/vector-1.c new file mode 100644 index 000000000..9be0be19b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-1.c @@ -0,0 +1,12 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +#define vector __attribute__((vector_size(16) )) +struct ss +{ + vector float mVec; +}; +float getCapsule(vector int t) +{ + vector float t1 = (vector float)t; + struct ss y = {t1}; + return *((float*)&y.mVec); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-2.c b/gcc/testsuite/gcc.c-torture/compile/vector-2.c new file mode 100644 index 000000000..e04d55588 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-2.c @@ -0,0 +1,13 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +#define vector __attribute__((vector_size(16) )) +struct ss +{ + vector float mVec; +}; +vector float getCapsule(vector int t) +{ + vector float t1 = (vector float)t; + struct ss y = {t1}; + *((float*)&y.mVec) = 1.0; + return y.mVec; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-3.c b/gcc/testsuite/gcc.c-torture/compile/vector-3.c new file mode 100644 index 000000000..6b7314881 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-3.c @@ -0,0 +1,7 @@ +#define vector __attribute__((vector_size(16) )) +vector float g(void) +{ + float t = 1.0f; + return (vector float){0.0, 0.0, t, 0.0}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-4.c b/gcc/testsuite/gcc.c-torture/compile/vector-4.c new file mode 100644 index 000000000..39c808543 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-4.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx" { target { i?86-*-* x86_64-*-* } } } */ + +/* Make sure that vector of size 8 of signed char works. This used to crash with AVX on x86 + as we would produce try to extract the chars inside the vector mode using the vector mode of V8SI + which was wrong. */ +__attribute__ ((vector_size (8))) signed char v4, v5, v6; +void +two (void) +{ + v4 = v5 + v6; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-align-1.c b/gcc/testsuite/gcc.c-torture/compile/vector-align-1.c new file mode 100644 index 000000000..dc97ba6ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-align-1.c @@ -0,0 +1,11 @@ +/* Check to make sure the alignment on vectors is not being lost. */ + +/* If some target has a Max alignment less than 128, please create + a #ifdef around the alignment and add your alignment. */ +#define alignment 128 + +char x __attribute__((aligned(alignment),vector_size(2))); + + +int f[__alignof__(x) == alignment?1:-1]; + diff --git a/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c b/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c new file mode 100644 index 000000000..6acc3d830 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c @@ -0,0 +1,5 @@ +/* Test TREE_CONSTANT VLA size: bug 27893. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +int a; +void g(void *); +void f(void) { int b[(__SIZE_TYPE__)&a]; g(b); } diff --git a/gcc/testsuite/gcc.c-torture/compile/vla-const-2.c b/gcc/testsuite/gcc.c-torture/compile/vla-const-2.c new file mode 100644 index 000000000..913a730b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vla-const-2.c @@ -0,0 +1,4 @@ +/* Test TREE_CONSTANT VLA size: bug 27893. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +void g(void *); +void f(void) { int b[1/0]; g(b); } diff --git a/gcc/testsuite/gcc.c-torture/compile/volatile-1.c b/gcc/testsuite/gcc.c-torture/compile/volatile-1.c new file mode 100644 index 000000000..cb81274c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/volatile-1.c @@ -0,0 +1,18 @@ +/* The problem here was that the statements that + loaded from exception.reason where not being + marked as having volatile behaviour which + caused load PRE on the tree level to go + into an infinite loop. */ + +struct gdb_exception +{ + int reason; +}; +int catch_exceptions_with_msg (int *gdberrmsg) +{ + volatile struct gdb_exception exception; + exceptions_state_mc_init (&(exception)); + if (exception.reason != 0) + foo (); + return exception.reason; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/widechar-1.c b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c new file mode 100644 index 000000000..5d89f33a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c @@ -0,0 +1 @@ +char *s = L"a" "b"; diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c new file mode 100644 index 000000000..d3db81269 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c @@ -0,0 +1,7 @@ +typedef struct { } empty_t; + +f () +{ + empty_t i; + bar (i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c new file mode 100644 index 000000000..0f97f7d12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c @@ -0,0 +1,2 @@ +struct { } foo = { }; +void * bar(void) { return &foo; } diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c new file mode 100644 index 000000000..31bc328d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c @@ -0,0 +1,12 @@ +typedef struct {} spinlock_t; +struct sk_buff_head { + int i; + spinlock_t lock; +}; +struct sk_buff_head audit_skb_queue; +void audit_init(void) +{ + struct sk_buff_head *list = &audit_skb_queue; + spinlock_t a = {}; + audit_skb_queue.lock = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c new file mode 100644 index 000000000..4a5889f80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c @@ -0,0 +1,14 @@ +typedef struct {} raw_spinlock_t; +typedef struct { + raw_spinlock_t raw_lock; +} spinlock_t; +struct sk_buff_head { + int i; + spinlock_t lock; +}; +struct sk_buff_head audit_skb_queue; +void audit_init(void) +{ + struct sk_buff_head *list = &audit_skb_queue; + audit_skb_queue.lock = (spinlock_t) { .raw_lock = { } }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c new file mode 100644 index 000000000..2dfbabe40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c @@ -0,0 +1,14 @@ +/* Check that the inliner does not crash for this testcase. + gimple_expr can change the expr to NULL meaning that we + should not add any statement. */ +struct f {}; +struct g1 {struct f l;}; + +static inline void g(struct f a, int i){} + +void h(void) +{ + struct g1 t; + g(t.l , 1); +} + |