summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.wendy
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
committerYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
commitbe8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch)
tree726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/gcc.wendy
initial commit
Diffstat (limited to 'gcc/testsuite/gcc.wendy')
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu1.c17
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu10.c11
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu11.c8
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu12.c36
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu13.c92
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu14.c23
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu15.c30
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu16.c16
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu17.c169
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu18.c46
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu19.c26
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu2.c122
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu20.c69
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu21.c30
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu22.c57
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu23.c60
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu24.c32
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu25.c55
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu26.c53
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu27.c28
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu28.c63
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu29.c80
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu3.c30
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu30.c83
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu31.c26
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu4.c15
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu5.c41
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu6.c8
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu7.c8
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu8.c8
-rwxr-xr-xgcc/testsuite/gcc.wendy/gnu9.c9
-rwxr-xr-xgcc/testsuite/gcc.wendy/wendy.dis180
32 files changed, 1531 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.wendy/gnu1.c b/gcc/testsuite/gcc.wendy/gnu1.c
new file mode 100755
index 0000000..8e7faab
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu1.c
@@ -0,0 +1,17 @@
+unsigned char msgi[10] = {0x10, 0x09, 0x88, 0xaa, 0x22, 0x09};
+#define MAGIC 0125252 /* checksum is subtracted from this */
+
+int
+main()
+{
+ unsigned short pktsum, oursum;
+
+ pktsum = msgi[2] + (msgi[3] << 8);
+
+ /* Check checksums for control packets */
+ oursum = MAGIC - msgi[4];
+ if (pktsum != oursum)
+ printf("control checksum bad %x %x\n", pktsum, oursum);
+ else
+ printf("Test passed\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu10.c b/gcc/testsuite/gcc.wendy/gnu10.c
new file mode 100755
index 0000000..9e445ba
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu10.c
@@ -0,0 +1,11 @@
+/*
+ * Unsigned bitfields now promote to signed ints in expressions, grumble.
+ */
+main() {
+ struct s {unsigned i9:9, i1:1;} x;
+ x.i9 = 0;
+ if ( x.i9 <= -139 )
+ printf("Failed...\n");
+ else
+ printf("Test passed\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu11.c b/gcc/testsuite/gcc.wendy/gnu11.c
new file mode 100755
index 0000000..8ca2fac
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu11.c
@@ -0,0 +1,8 @@
+/* DEJAGNU_OUTPUT:"Failed (if it compiled at all)..." */
+
+main() {
+ int s;
+
+ s = sizeof main;
+ printf("Failed (if it compiled at all)...\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu12.c b/gcc/testsuite/gcc.wendy/gnu12.c
new file mode 100755
index 0000000..fe31c59
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu12.c
@@ -0,0 +1,36 @@
+/*
+Deceived: by hoptoad.uucp (1.1/SMI-3.0DEV3)
+ id AA08037; Wed, 1 Apr 87 03:40:07 PST
+Message-Id: <8704010914.AA23555@prep.ai.mit.edu>
+Date: 31 Mar 1987 2359-PST (Tuesday)
+From: Malcolm Wing <wing@sonoma.stanford.edu>
+To: bug-gcc@prep.ai.mit.edu
+Subject: Clobber nil bug and Tail recursion bug
+
+BUG 2
+ When compiling Ackerman for the vax it tries to remove the
+tail recursion. However the tail recursive call contains another
+call so the update (used to be parameter passing) can't be done
+until the imbedded call returns.
+
+SOURCE
+
+/* Ackerman's function */
+main()
+{
+ int i;
+
+ i = A(3,6);
+ if (i == 509)
+ printf("Test passed\n");
+ else
+ printf("FAILED ackerman's(3, 6): %d\n", i);
+}
+
+A(x,y)
+int x,y;
+{
+ if(x==0) return(++y);
+ if(y==0) return(A(--x,1));
+ return(A(x-1,A(x,--y)));
+ }
diff --git a/gcc/testsuite/gcc.wendy/gnu13.c b/gcc/testsuite/gcc.wendy/gnu13.c
new file mode 100755
index 0000000..d7db170
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu13.c
@@ -0,0 +1,92 @@
+/*
+Date: Tue, 21 Apr 87 09:58:10 PDT
+From: aks@acc-sb-unix.arpa (Alan Stebbens)
+To: bug-gcc@PREP.AI.MIT.EDU
+Subject: Optimizer doesn't.
+
+Dear GCC guys:
+
+The following simple C program illustrates a problem with the
+current version of GCC. What happens is that D3 is used doubly:
+once for loop limit testing, and once for long constant stores.
+Also, a loop limit test is being performed for the first iteration
+even when both the initial value and the ending values are known
+constants. Most optimizers can avoid the initial test if these
+values are known.
+
+Thanks for your time.
+
+Alan Stebbens (aks@acc-sb-unix.ARPA)
+
+==================== tst1.c ====================
+*/
+int array[100];
+int darray[10][10];
+
+main()
+{
+ register int i, j;
+ for (i = 0; i < 100; i++) array[i] = 3;
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ darray[i][j] = 3;
+ return 0;
+}
+
+/*
+==================== tst1.s ====================
+.comm _array,400
+.comm _darray,400
+.globl _main
+.text
+ .even
+_main:
+ link a6,#0
+ moveml #0x3030,sp@-
+ clrl d2
+ lea _array,a0
+ moveq #100,d3 <------ D3 now has limit of the test
+ cmpl d2,d3
+ jle L19
+L2:
+ moveq #3,d3 <----- D3 is being reused!!
+ movl d3,a0@(d2:l:4)
+ addql #1,d2
+ moveq #100,d3 <----- D3 is being reloaded!
+ cmpl d2,d3
+ jgt L2
+L19:
+ clrl d2
+ lea _darray,a2
+ moveq #10,d3
+ cmpl d2,d3
+ jle L18
+L7:
+ clrl d1
+ movl d2,d0
+ asll #5,d0
+ movl d0,a3
+ lea a3@(d2:l:8),a1
+ moveq #10,d3
+ cmpl d1,d3
+ jle L17
+L10:
+ lea a1@(d1:l:4),a0
+ moveq #3,d3
+ movl d3,a2@(a0:l)
+ addql #1,d1
+ moveq #10,d3
+ cmpl d1,d3
+ jgt L10
+L17:
+ addql #1,d2
+ moveq #10,d3
+ cmpl d2,d3
+ jgt L7
+L18:
+ moveml a6@(-16),#0xc0c
+ unlk a6
+ rts
+
+Alan Stebbens (aks@acc-sb-unix.ARPA)
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu14.c b/gcc/testsuite/gcc.wendy/gnu14.c
new file mode 100755
index 0000000..9b241c3
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu14.c
@@ -0,0 +1,23 @@
+/*
+Return-Path: <ucsfcgl!TOR.NTA.NO!H_Eidnes%vax.runit.unit.uninett>
+Date: Tue, 23 Jun 87 17:17:38 +0200
+From: H}vard Eidnes <ucsfcgl!TOR.NTA.NO!H_Eidnes%vax.runit.unit.uninett>
+To: <bug-gcc@prep.ai.mit.edu>
+Message-Id: <2178:H_Eidnes@vax.runit.unit.uninett>
+Subject: Spurious error-message (?) from GCC
+
+The following is an exerpt from a header file from the X Window
+System, version 10r3.
+
+GCC (version 1.5) says:
+/usr/include/X/Xlib.h:108: declaration of table invalidly omits array size
+*/
+
+typedef struct _x_assoc_table {
+ struct _x_assoc (*table)[]; /* Array of association queues. */
+ int size; /* Table size. */
+} XAssocTable;
+
+main() {
+ printf("Test passed\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu15.c b/gcc/testsuite/gcc.wendy/gnu15.c
new file mode 100755
index 0000000..3b269f5
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu15.c
@@ -0,0 +1,30 @@
+/*
+Date: Sun, 5 Jul 87 18:24:54 PDT
+From: andy@csvax.caltech.edu (Andy Fyfe)
+To: bug-gcc@prep.ai.mit.edu
+Subject: unsigned -> float conversion
+*/
+
+main()
+{
+ unsigned u = 0x80000000;
+
+ printf("(f)u = %g\n", (float)u);
+ printf("(f)(u)0x80000000 = %g\n", (float)(unsigned)0x80000000);
+
+ exit(0);
+}
+
+/*
+Using 68020/68881 the above gives:
+
+(f)u = 2.14748e+09
+(f)(u)0x80000000 = -2.14748e+09
+
+Using 68020/soft-float the above gives:
+
+(f)u = -2.14748e+09
+(f)(u)0x80000000 = -2.14748e+09
+
+gcc, version 1.6, compiled on a sun3 by gcc itself.
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu16.c b/gcc/testsuite/gcc.wendy/gnu16.c
new file mode 100755
index 0000000..071afa9
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu16.c
@@ -0,0 +1,16 @@
+int install = !0; /* Gcc 1.16 said "initializer is not constant" */
+ /* Gcc 1.17 gets wrong answer! */
+char foo = !1;
+int bar = !3.14156; /* SunOS 3.3 cc said "Illegal initialization" */
+int pno = ! &bar; /* Gcc 1.17 said "initializer for static variable
+ uses complex arithmetic" */
+int pyes = !(char *)0;
+
+main() {
+ if (install && !foo && !bar && pyes && !pno)
+ printf("Test passed\n");
+ else
+ printf("FAILED, install=%d, foo=%d, bar=%d, pno=%d, pyes=%d\n",
+ install, foo, bar, pno, pyes);
+}
+
diff --git a/gcc/testsuite/gcc.wendy/gnu17.c b/gcc/testsuite/gcc.wendy/gnu17.c
new file mode 100755
index 0000000..d3b03c1
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu17.c
@@ -0,0 +1,169 @@
+#if 0
+/*
+Date: Mon, 17 Aug 87 09:03:50 PDT
+From: bruce@stride.stride.com (Bruce Robertson)
+To: bug-gcc@prep.ai.mit.edu
+Subject: Optimizer bug in gcc 1.x
+
+I found the cause of the optimizer bug that I've been sending you. It
+occurs because you scan for the first and last occurances of registers
+before common subexpression processing, but cse can change these
+occurances. The bug appears in the example program because loop
+optimization removes a load of "mem" into a pseudo-register, because
+based on the information of the register scan it thinks that there are
+no more appearances of the pseudo-register. Cse added a reference,
+however, and this information is not placed in regno_last_uid[]. The
+solution seems to be to call reg_scan() again after calling
+cse_main(). It fixed the bug anyway, and didn't seem to cause
+anything bad.
+
+Diffs for the fix, and the original sample program follow.
+
+
+Diffs:
+======================================================================
+*** /tmp/,RCSt1a00495 Thu Aug 13 13:09:01 1987
+--- toplev.c Thu Aug 13 13:08:39 1987
+***************
+*** 776,781 ****
+--- 776,786 ----
+
+ TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num ()));
+
++ /* We need to scan for registers again, because common subexpression
++ elimination could have rearranged the first and last occurrances
++ of registers. */
++ TIMEVAR (cse_time, reg_scan (insns, max_reg_num ()));
++
+ if (tem)
+ TIMEVAR (jump_time, jump_optimize (insns, 0, 0));
+ }
+
+
+
+Sample program:
+======================================================================
+#endif
+
+typedef unsigned char quarterword;
+typedef unsigned short halfword;
+
+typedef union
+{
+ struct {
+ halfword lh;
+ halfword rh;
+ } hh1;
+ struct {
+ quarterword b0;
+ quarterword b1;
+ halfword rh;
+ } hh2;
+}
+ two_halves;
+
+typedef struct
+{
+ quarterword b0;
+ quarterword b1;
+ quarterword b2;
+ quarterword b3;
+}
+ four_quarters;
+
+typedef union
+{
+ int i;
+ float gr;
+ two_halves hh;
+ four_quarters qqqq;
+}
+ memory_word;
+
+memory_word mem[10];
+
+unsigned int fewest_demerits;
+unsigned short best_bet = 0;
+unsigned short best_line = -1;
+
+
+void
+foo(r)
+ unsigned short r;
+{
+
+ do {
+ if (mem[r].hh.hh2.b0 != 2 &&
+ mem[(r) + 2].i < fewest_demerits) {
+ best_bet = r;
+ }
+ r = mem[r].hh.hh1.rh;
+ } while (r != (65501 - 7));
+
+ /*
+ * This is the statement that is causing trouble. See the comment
+ * in the assembly code below.
+ */
+ best_line = mem[best_bet + 1].hh.hh1.lh;
+}
+
+main()
+{
+ mem[0].hh.hh2.b0 = 0;
+ mem[0].hh.hh1.rh = 65501-7;
+ mem[1].hh.hh1.lh = 456;
+ mem[2].i = 30;
+ foo(0);
+ if (best_line == 456)
+ printf("Test passed\n");
+ else
+ printf("Test failed, best_line = %d\n", best_line);
+}
+
+/*
+
+#NO_APP
+.comm _fewest_demerits,4
+.comm _best_bet,2
+.comm _best_line,2
+.globl _foo
+.text
+ .even
+_foo:
+ link a6,#0
+ moveml #0x3000,sp@-
+ movew #1,d0
+ clrl d1
+ clrl d2
+ lea _mem,a0
+L2:
+ movew d0,d1
+ cmpb #2,a0@(d1:l:4)
+ jeq L4
+ movel a0@(8,d1:l:4),d3
+ cmpl _fewest_demerits,d3
+ jcc L4
+ movew d0,_best_bet
+L4:
+ movew d0,d2
+ movew a0@(2,d2:l:4),d0
+ cmpw #65494,d0
+ jne L2
+ clrl d0
+ movew _best_bet,d0
+
+|
+| Where did this reference (below) to A1 come from? It should be A0,
+| since that still points to "mem". A1 is never set in the code
+| above.
+|
+| When this code fragment is in place in Common Tex (in function
+| "line_break()" in file "par.c") the reference is to -4(fp)
+| rather than A1.
+|
+
+ movew a1@(4,d0:l:4),_best_line
+ moveml a6@(-8),#0xc
+ unlk a6
+ rts
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu18.c b/gcc/testsuite/gcc.wendy/gnu18.c
new file mode 100755
index 0000000..e66c4f6
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu18.c
@@ -0,0 +1,46 @@
+/*
+Date: Sat, 5 Sep 87 00:34:13 PDT
+From: gnu (John Gilmore)
+To: rms
+Subject: Stack adjustment bug in 'continue' -- gcc 1.10+
+
+Compiling the following simplified program with or without -O produces
+bad code. The 'continue' compiles to a jump to a label which PRECEDES
+the stack adjust for the printf at the end of the loop. This makes the
+stack pointer walk up each time around the loop. If you compile without
+-O, "foo" gets allocated on the stack and the debug printf fires.
+Compiled with -O, it coredumps before printing. Compiled on a working
+compiler, it loops forever.
+
+I have installed the bugfix for while loops posted to bug-gcc; it fails
+with or without the bugfix.
+*/
+
+int tty;
+
+iscmd() {
+ static int counter;
+
+ if (counter++ < 10000) return 0;
+ printf("Test passed\n");
+ exit(0);
+}
+
+void
+main()
+{
+ int foo = 0;
+
+ for ( ;; ) {
+ if (foo != 0) printf("***BUG*** foo=%x\n", foo);
+ if (!tty) {
+ if (!iscmd ())
+ continue;
+ foo = 1;
+ }
+
+ printf("**BUG** Past iscmd\n");
+ }
+
+ return;
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu19.c b/gcc/testsuite/gcc.wendy/gnu19.c
new file mode 100755
index 0000000..dfa7d32
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu19.c
@@ -0,0 +1,26 @@
+/*
+Date: Wed, 7 Oct 87 11:54:57 PDT
+From: faustus%ic.Berkeley.EDU@cad.Berkeley.EDU (Wayne A. Christopher)
+To: bug-gcc@PREP.AI.MIT.EDU
+Subject: GNU CC bug
+
+The following fragment of code causes the message "xx.c:7: parse error" to
+be printed:
+*/
+ typedef struct foo {
+ int i;
+ } foo;
+
+ typedef struct bar {
+ foo *foo;
+ } bar;
+
+main(){
+ printf("Test passed (if it compiled)\n");
+}
+/*
+I can't find anything in the ANSI standard saying that a structure tag can't
+be the same as a typedef name.
+
+ Wayne
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu2.c b/gcc/testsuite/gcc.wendy/gnu2.c
new file mode 100755
index 0000000..296c34c
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu2.c
@@ -0,0 +1,122 @@
+/*
+ * Causes gnu cc 1.14 to coredump. Not sure why.
+ * An excerpt from PD tar's "list.c" file.
+ */
+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 unsigned int uint;
+
+
+
+
+
+
+
+
+typedef struct _physadr { short r[1]; } *physadr;
+typedef struct label_t {
+ int val[13];
+} 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 int off_t;
+typedef long key_t;
+
+typedef struct fd_set { int fds_bits[1]; } fd_set;
+
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ time_t st_atime;
+ int st_spare1;
+ time_t st_mtime;
+ int st_spare2;
+ time_t st_ctime;
+ int st_spare3;
+ long st_blksize;
+ long st_blocks;
+ long st_spare4[2];
+};
+
+union record {
+ char charptr[512 ];
+ struct header {
+ char name[100 ];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char chksum[8];
+ char linkflag;
+ char linkname[100 ];
+ char magic[8];
+ char uname[32 ];
+ char gname[32 ];
+ char devmajor[8];
+ char devminor[8];
+ } header;
+};
+long from_oct();
+
+decode_header(header, st, stdp, wantug)
+ register union record *header;
+ register struct stat *st;
+ int *stdp;
+ int wantug;
+{
+
+ st->st_mode = from_oct(8, header->header.mode);
+ st->st_mtime = from_oct(1+12, header->header.mtime);
+
+ if (0==strcmp(header->header.magic, "ustar " )) {
+
+ *stdp = 1;
+ if (wantug) {
+ st->st_uid = finduid(header->header.uname);
+ st->st_gid = findgid(header->header.gname);
+ }
+ switch (header->header.linkflag)
+ case '4' : case '3' :
+ st->st_rdev = ((dev_t)(((from_oct(8, header->header.devmajor))<<8) | (
+ from_oct(8, header->header.devminor)))) ;
+ } else {
+ *stdp = 0;
+ st->st_uid = from_oct(8, header->header.uid);
+ st->st_gid = from_oct(8, header->header.gid);
+ st->st_rdev = 0;
+ }
+}
+
+main(){
+ printf("Test passed (if it compiled at all)\n");
+}
+
+long from_oct(x)
+ char *x;
+{
+ return 0;
+}
+
+int finduid(x) char *x;
+{ return 0; }
+
+int findgid(x) char *x;
+{ return 0; }
diff --git a/gcc/testsuite/gcc.wendy/gnu20.c b/gcc/testsuite/gcc.wendy/gnu20.c
new file mode 100755
index 0000000..5c02677
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu20.c
@@ -0,0 +1,69 @@
+/*
+Return-Path: <ucsfcgl!reagan.ai.mit.edu!RUTGERS.EDU!RUTGERS.EDU!uiucdcs!uiucuxc!sys1!sneaky!gordon>
+Date: Tue Dec 15, 1987 at 10:25:42 cst
+From: uiucdcs!uiucuxc!sys1!sneaky!gordon@rutgers.edu (Gordon Burditt)
+Message-Id: <8712151625.AA15898@sneaky.UUCP>
+To: uiucdcs!uiucuxc!sys1!techsup!vaxnix!ron@rutgers.edu,
+ bug-gcc@prep.ai.mit.edu
+Subject: gcc bug
+Sent: Tue Dec 15, 1987 at 10:25:42 cst
+
+I have been asked to pass along this bug report for gcc 1.15.
+I am having trouble figuring out from the ANSI spec whether this really
+is a bug or not. ANSI says that side effects caused by function argument
+evaluation must be complete by the time the call is done, but how about side
+effects in evaluating the function address?
+
+From: ron@vaxnix.tandy.COM (Ron Light)
+Date: Sat, 12 Dec 87 7:50:53 CST
+*/
+
+typedef int (*Inst)(); /* machine instruction */
+#define STOP (Inst)(0)
+
+Inst *pc; /* program counter during execution */
+
+execute(p) /* run the machine */
+Inst *p;
+{
+ for(pc = p; *pc != STOP;)
+ (*(*pc++))();
+}
+
+int inst();
+Inst instrs[] = {inst, inst, inst, STOP};
+int inst() {
+ if (pc == &instrs[1])
+ printf("Test passed\n");
+ else
+ printf("FAILED, pc = %x, instrs = %x\n", pc, instrs);
+ exit(0);
+}
+main()
+{
+
+ execute(instrs);
+}
+/*
+code produced by gcc:
+.text
+ .even
+.globl _execute
+_execute:
+ link a6,#0
+ movl a6@(8),_pc
+ jra L2
+L5:
+ movl _pc,a0
+ movl a0@,a0 ;<---------------------------+
+ jbsr a0@ ; |
+ addql #4,_pc ; This should be here--------+
+L2:
+ movl _pc,a0
+ tstl a0@
+ jne L5
+ unlk a6
+ rts
+.comm _pc,4
+
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu21.c b/gcc/testsuite/gcc.wendy/gnu21.c
new file mode 100755
index 0000000..7a3067b
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu21.c
@@ -0,0 +1,30 @@
+/*
+Message-Id: <8712292244.AA24155@prep.ai.mit.edu>
+Date: Mon, 28 Dec 87 21:05:20 PST
+From: Greg Satz <satz@clutter.cisco.com>
+To: bug-gcc@prep.ai.mit.edu
+Subject: Error handling bug?
+
+The following program causes cc1 to make a core file. Since it was
+caused by a syntax error, I didn't spend that much time tracking it
+down. I was able to reduce the example to this small result. Could
+someone check to see if this bug exists in the Vax and Sun versions as
+well and let me know? Thanks!
+*/
+
+int global;
+main()
+{
+ int ch;
+
+ if (global) {
+ printf("here");
+ } else {
+ if (((ch & 0x7f) == 0)) && (ch & 1)) { /* syntax error here */
+ if (!ch)
+ return(0);
+ ch = 0;
+ }
+ }
+}
+
diff --git a/gcc/testsuite/gcc.wendy/gnu22.c b/gcc/testsuite/gcc.wendy/gnu22.c
new file mode 100755
index 0000000..b1326a6
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu22.c
@@ -0,0 +1,57 @@
+/*
+From ptsfa!ames!sdcsvax!nosc!cod!owen Mon Dec 28 14:54:53 1987
+From: owen@cod.NOSC.MIL (Wallace E. Owen)
+Newsgroups: comp.lang.c
+Subject: msc bitfield bug
+Message-ID: <934@cod.NOSC.MIL>
+Date: 28 Dec 87 22:54:53 GMT
+Organization: Naval Ocean Systems Center, San Diego
+
+The following small bug in Microsoft 'C' (4.0) handling of forcing
+a bitfield to the next int or long was revealed while developing a Large
+piece of software. It's in the form of a small program which reveals the
+bug:
+
+/*
+ This short program displays a bug in MS C buildout of bitfield expressions.
+ Problem: Forcing bit field alignment to the next unsigned int or unsigned
+ long works if the next statement is a bitfield expression, but if it's
+ a unsigned long for instance, the padding ':0;' forces an extra item to
+ be allocated BETWEEN the two expressions. Must be the method used
+ to force bitfield to the next unsigned int or unsigned long. Should check
+ that indeed the next statement IS a bitfield expression.
+*/
+
+struct testa /* 8 bytes */
+{
+ unsigned long
+ a: 5, b: 5, c: 5, d: 5, e: 5, : 0;
+ unsigned long
+ f: 8, g: 8, h: 8, i: 8;
+};
+
+struct testb /* Should be 8 bytes, but it's 12! */
+{
+ unsigned long
+ a: 5, b: 5, c: 5, d: 5, e: 5, : 0;
+ unsigned long f;
+};
+
+main()
+{
+ /* Print sizes of things */
+ if (sizeof (struct testa) == sizeof (struct testb)) {
+ printf("Test passed\n");
+ } else {
+ printf("Size of struct testa: %u\n", sizeof( struct testa));
+ printf("Size of struct testb: %u\n", sizeof( struct testb));
+ }
+}
+
+/*
+I'm going to try this with 5.0- Also, while at the c++ conference in
+Santa Fe, met the author of MSC 5.0's front end, and showed him this code.
+ -- Wallace Owen
+ (owen@cod.nosc.mil)
+ (619) 553-3567
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu23.c b/gcc/testsuite/gcc.wendy/gnu23.c
new file mode 100755
index 0000000..1865313
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu23.c
@@ -0,0 +1,60 @@
+/* From Sun-Spots v6n11
+Date: Fri, 22 Jan 88 10:07:18 EST
+From: im4u!rutgers!rochester!srs!matt@ut-sally.UUCP
+Subject: Bug in C compiler
+
+We have had a bug in our main signal analysis tool for well over a year.
+Occasionally, and apparently w/o any regularity, one of the graphs (a
+raster display of FFTs of an input signal) would produce what looked like
+garbage, but tended to follow the basic trend of the input data.
+Recompiling the tool sometimes changed the frequency of occurance and with
+the latest changes, it tended to occur quite often. Well, I have finally
+tracked it down to a compiler problem and this bug will bother us no
+more...
+
+Release: Sun OS 3.2
+Systems: Sun3, Sun2
+Comment: The following program outputs (erroneously) 0xff00 for the
+ second call to screwit(). Basically, the compiler fails to
+ clear the upper half of "d7" before adding it into "a".
+ "a" can be a signed or unsigned short. If "a" is an int
+ (long), it appears to work correctly.
+
+gnu@toad.com comment: Appears to only fail this with without -O, probably
+ because the stores to d7 in main() are removed by c2.
+*/
+#include <stdio.h>
+static int fail;
+
+main()
+{
+ register short d7;
+ unsigned char b = 0;
+
+ d7 = 0x00ff;
+ screwit(&b);
+ d7 = 0xffff;
+ screwit(&b);
+ if (!fail)
+ printf("Test passed\n", d7);
+ else
+ printf("Test FAILED\n", d7);
+}
+
+screwit(b)
+register unsigned char *b;
+{
+ register unsigned char d7;
+ register unsigned short a = 0;
+
+ d7 = *b;
+ a += (unsigned short) d7;
+ if (a == 0) return;
+ printf("C: 0x%04x\n", a);
+ fail++;
+}
+
+/*
+UUCP: {allegra,rutgers,ames}!rochester!srs!matt Matt Goheen
+ "First the pants, THEN the shoes." S.R. Systems
+*/
diff --git a/gcc/testsuite/gcc.wendy/gnu24.c b/gcc/testsuite/gcc.wendy/gnu24.c
new file mode 100755
index 0000000..71bb3cc
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu24.c
@@ -0,0 +1,32 @@
+/* From Sun-Spots v6n12
+Date: 26 Jan 88 15:58:58 CST (Tue)
+From: uunet!mcrware!jejones@ut-sally.UUCP
+Subject: ?: vs. pointer to function "returning" void
+
+I find that on a Sun 3, the C compiler complains about code of the following
+form with a message "operands of : have incompatible types." I don't think
+this is correct, because woof1 and woof2 are both pointers to functions
+"returning" void, so that (pointer to function returning void) should be
+the type of the actual parameter. Right?
+
+Have other people seen this problem? Is it, if it is indeed a problem
+with the Sun C compiler, fixed in some release?
+
+ James Jones
+*/
+
+void woof1() {};
+void woof2() {};
+
+main(i, argv)
+int i;
+char **argv;
+{
+ bletch(i ? woof1 : woof2);
+ printf("Test passed (if it compiled at all)\n");
+}
+
+bletch(x)
+ void (*x)();
+{
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu25.c b/gcc/testsuite/gcc.wendy/gnu25.c
new file mode 100755
index 0000000..dcc13fc
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu25.c
@@ -0,0 +1,55 @@
+/*
+ * gnu25.c
+ *
+ * This was originally reported as a bug in the Sun C compiler in
+ * Sun-Spots, by ihnp4!stcvax!stc-auts!kak, but he forgot to declare
+ * double sqrt(). However, the code generated for the initialization
+ * by gcc-1.19 plus a fix, reuses fp0 for both arguments of the divide.
+ * oops! the result is always 1!
+
+ John Gilmore, 16April88
+ *
+ * showbug
+ * compile: cc showbug.c -o showbug -lm
+ */
+double sqrt();
+compare(a, b)
+ double a, b;
+{
+
+ if (a != b) return 1; /* Not computed the same */
+ if (a > 0.014) return 1; /* Wrong answer */
+ if (a < 0.012) return 1; /* Wrong answer */
+ return 0;
+}
+main()
+{
+ float mean = 0.035000;
+ int samples = 200;
+ {
+ double sigma = sqrt( (mean*(1 - mean))/ samples);
+
+ if (compare(sigma,
+ sqrt((mean*(1 - mean))/ samples ))) {
+
+ printf("sigma = sqrt( (%f)/%d) ",
+ (mean*(1 - mean)), samples );
+ printf("= sqrt( %f ) ",
+ (mean*(1 - mean))/ samples );
+ printf("= %f ",
+ sqrt((mean*(1 - mean))/ samples ));
+ printf("= %f (!)\n", sigma );
+ } else {
+ printf("Test passed\n");
+ }
+ }
+}
+
+/* We'd like to link with -lm, but "runt" doesnt do this. */
+double sqrt(x) double x;
+{
+ /* Quick fakery. */
+ if (x > .000165 && x < .00017) /* arg is right */
+ return .0129951914; /* Right result */
+ return 0; /* CHeap imitation sqrt routine */
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu26.c b/gcc/testsuite/gcc.wendy/gnu26.c
new file mode 100755
index 0000000..63cf048
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu26.c
@@ -0,0 +1,53 @@
+/*
+Deceived: by hoptoad.uucp (1.1/SMI-3.0DEV3)
+ id AA08037; Wed, 1 Apr 87 03:40:07 PST
+Message-Id: <8704010914.AA23555@prep.ai.mit.edu>
+Date: 31 Mar 1987 2359-PST (Tuesday)
+From: Malcolm Wing <wing@sonoma.stanford.edu>
+To: bug-gcc@prep.ai.mit.edu
+Subject: Clobber nil bug and Tail recursion bug
+
+BUG 2
+ When compiling Ackerman for the vax it tries to remove the
+tail recursion. However the tail recursive call contains another
+call so the update (used to be parameter passing) can't be done
+until the imbedded call returns.
+
+SOURCE
+
+/* Ackerman's function */
+main()
+{
+ int i, j;
+
+ i = A(3,6);
+ j = B(3,6);
+ if (i == 509 && j == 509 && i == j)
+ printf("Test passed\n");
+ else
+ printf("FAILED ackerman's(3, 6): %d, %d\n", i, j);
+}
+
+A(x,y)
+int x,y;
+{
+ if(x==0) return(++y);
+ if(y==0) return(A(--x,1));
+ return(A(x-1,A(x,--y)));
+}
+
+/* This one is more in the true spirit of the original Algol code. */
+B(m,n)
+int m,n;
+{
+ return m==0 ? n+1 : n==0 ? B(m-1,1) : B(m-1,B(m,n-1));
+}
+
+/* Try it with subtract/add rather than ++ and -- */
+C(x,y)
+int x,y;
+{
+ if(x==0) return(y+1);
+ if(y==0) return(C(x-1,1));
+ return(C(x-1,C(x,y-1)));
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu27.c b/gcc/testsuite/gcc.wendy/gnu27.c
new file mode 100755
index 0000000..f197737
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu27.c
@@ -0,0 +1,28 @@
+/* DEJAGNU_OUTPUT:"Test failed (if it compiles at all)" */
+
+/*
+ * This program should generate at least a warning; preferably an error.
+ */
+int *
+main()
+{
+ int local = 1;
+
+ printf("Test failed (if it compiles at all)\n");
+
+ return &local;
+}
+
+/*
+ * RMS comments:
+ *
+Date: Sun, 18 Dec 88 14:39:18 EST
+From: rms@wheaties.ai.mit.edu (Richard Stallman)
+To: gnu@toad.com
+Subject: gcc-1.31 sparc test suite results
+
+I do not anticipate that gnu27.c will ever produce a warning
+message. I can see kludgy ways to produce them in simple cases,
+but more complicated circumlocutions would avoid them. In general
+the problem is uncomputable.
+ */
diff --git a/gcc/testsuite/gcc.wendy/gnu28.c b/gcc/testsuite/gcc.wendy/gnu28.c
new file mode 100755
index 0000000..943fda8
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu28.c
@@ -0,0 +1,63 @@
+/*
+From: uunet!mcvax!sor.inria.fr!tiemann (Mike Tiemann)
+Date: Sun, 4 Sep 88 11:15:27 +0100
+
+I got all your tests working (except str1597a.c), and the compiler
+bootstrapping itself, and I thought I was done. Then I remembered
+*my* favorite test program...which used to work, but now fails again.
+Here it is, for your collecting joy:
+
+[Altered in obvious ways to avoid using function prototypes -- gnu]
+*/
+
+/* a reasonably sized structure. */
+typedef struct foo
+{
+ int x[57];
+} foo;
+
+int bad = 0;
+
+foo sum (x, y)
+ foo x; foo y;
+{
+ foo s;
+ int i;
+
+ for (i = 0; i < 57; i++)
+ {
+ if (x.x[i] != 1) {printf("sum x[%d] = %d\n", i, x.x[i]); bad++;}
+ if (y.x[i] != 2) {printf("sum y[%d] = %d\n", i, y.x[i]); bad++;}
+ s.x[i] = x.x[i] + y.x[i];
+ }
+ return s;
+}
+
+foo init (val)
+ int val;
+{
+ foo s;
+ int i;
+
+ for (i = 0; i < 57; i++)
+ s.x[i] = val;
+ return s;
+}
+
+main ()
+{
+ foo s;
+ foo t;
+ int i;
+
+ s = sum (init (1), init (2));
+ t = sum (init (1), init (2));
+
+ for (i = 0; i < 57; i++)
+ if (s.x[i] != 3 || t.x[i] != 3) {
+ printf ("failure at %i\n", i);
+ bad++;
+ }
+ if (bad) printf ("Failed %d ways.\n", bad);
+ else printf ("Test passed.\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu29.c b/gcc/testsuite/gcc.wendy/gnu29.c
new file mode 100755
index 0000000..98f0164
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu29.c
@@ -0,0 +1,80 @@
+/*
+Date: 25 Jan 89 14:43:05 GMT
+From: meyering@cs.utexas.edu (Jim Meyering)
+Subject: 1.32 sun4os4 bug-- passing structures
+Message-Id: <150@ai.cs.utexas.edu>
+To: bug-gcc@prep.ai.mit.edu
+ */
+
+/*
+ * gcc-1.32 (sun4-os4) has a problem passing structure arguments.
+ *
+ * If the type FLT is changed to float, all problems disappear.
+ *
+ * If PRINTF is defined and -O is *not* used, the program terminates
+ * with a segmentation fault. In all other cases I've tried, the
+ * program runs, but the arguments to foo are not properly copied.
+ * To be precise, in foo, the value that one would normally expect
+ * to find in b.y is overwritten with that of b.x. (see output in
+ * comments below)
+ */
+
+typedef double FLT;
+typedef struct point { FLT x, y; } PT;
+
+#define N 4
+FLT x[N];
+
+#if defined(PRINTF)
+#define PRINT(a) for (i=0;i<N;i++) printf("%g ", (a)[i]); printf("\n");
+#endif
+
+#if defined(FPRINTF) || !defined(PRINTF)
+#include <stdio.h>
+#define PRINT(a) for (i=0;i<N;i++) fprintf(stdout,"%g ", (a)[i]); \
+ fprintf(stdout,"\n");
+#endif
+
+ void
+main()
+{
+ int bad,i;
+ PT s,t;
+ FLT w[N];
+ void foo(PT,PT);
+
+ s.x = 0;
+ s.y = 1;
+ t.x = 999;
+ t.y = 3;
+ w[0] = s.x; w[1] = s.y;
+ w[2] = t.x; w[3] = t.y;
+
+ foo(s,t);
+
+ bad = -1;
+ for (i=0;i<N;i++) {
+ if (w[i] != x[i]) {
+ bad = i;
+ break;
+ }
+ }
+
+ if (bad >= 0) {
+ PRINT(w);
+ PRINT(x);
+ } else {
+ printf("Test passed.\n");
+ }
+ exit(0);
+}
+
+ void
+foo(PT a,PT b)
+{
+ extern FLT x[N];
+ x[0] = a.x;
+ x[1] = a.y;
+ x[2] = b.x;
+ x[3] = b.y;
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu3.c b/gcc/testsuite/gcc.wendy/gnu3.c
new file mode 100755
index 0000000..ba3ca12
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu3.c
@@ -0,0 +1,30 @@
+/*
+ * From ptsfa!ames!hc!siegel Tue Nov 24 15:38:28 1987
+ * From: siegel@hc.DSPO.GOV (Josh Siegel)
+ * Newsgroups: comp.bugs.4bsd
+ * Subject: Bug in Sun compiler...
+ * Message-ID: <11636@hc.DSPO.GOV>
+ * Date: 24 Nov 87 23:38:28 GMT
+ * Organization: Los Alamos National Laboratory
+ *
+ * The program causes Suns compiler to generate code that
+ * has a Segmentation fault upon exiting.
+ *
+ * The reason being that Sun don't check to see if you specificly
+ * returned a structure. The register d0 is null and it offsets
+ * through it.
+ *
+ * Vax and GNU do this correctly...
+ */
+
+struct {
+ int a,b,c;
+ }
+bar()
+{}
+
+main()
+{
+ bar();
+ printf("Test passed\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu30.c b/gcc/testsuite/gcc.wendy/gnu30.c
new file mode 100755
index 0000000..a032e5f
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu30.c
@@ -0,0 +1,83 @@
+/*
+Message-Id: <8901111052.AA21004@hop.toad.com>
+To: rms
+Cc: gnu
+Subject: gcc-1.32 sparc bug: uses invalid addressing mode
+Date: Wed, 11 Jan 89 02:52:19 -0800
+From: gnu
+
+The following program crashes because
+
+ sth ...,[_foo]
+
+is not valid, since it only has a few displacement bits but needs to represent
+a 32-bit address. Unfortunately the Sun assembler does not catch this at
+assembly time, nor does the linker complain.
+
+This is excerpted from gnuchess.
+
+I tried to track it down myself; things are OK through the lreg pass,
+which marks this pseudo-reg as live in "-1" instrs, indicating that
+it is infrequently used and should not get a register. Greg deletes
+the instruction that loads it, and substitutes the name _Developed
+for the pseudo-reg, apparently not realizing that this is invalid.
+
+ John
+
+[In gcc-1.33 prototype, this coredumps cc1 in
+#0 0x77978 in next_insn_tests_no_inequality (insn=(rtx) 0xa6750) (recog.c line 97)
+#1 0x60858 in subst (x=(rtx) 0xa66a0, to=(rtx) 0xa6630, from=(rtx) 0xa6628) (combine.c line 1063)
+#2 0x5fd44 in subst (x=(rtx) 0xa6728, to=(rtx) 0xa6630, from=(rtx) 0xa6628) (combine.c line 852)
+#3 0x5fd44 in subst (x=(rtx) 0xa6880, to=(rtx) 0xa6630, from=(rtx) 0xa6628) (combine.c line 852)
+#4 0x5fd44 in subst (x=(rtx) 0xa6740, to=(rtx) 0xa6630, from=(rtx) 0xa6628) (combine.c line 852)
+#5 0x5f3c0 in try_combine (i3=(rtx) 0xa6750, i1=(rtx) 0xa6648, i2=(rtx) 0xa66c0) (combine.c line 521)
+#6 0x5eb58 in combine_instructions (f=(rtx) 0xa6828, nregs=276) (combine.c line 272)
+#7 0x1ad1c in rest_of_compilation (decl=(tree) 0xa8cf0) (toplev.c line 1357)
+#8 0x10cb8 in finish_function () (c-decl.c line 3507)
+#9 0x5d7c in yyparse () (c-parse.y line 244)
+#10 0x19ed8 in compile_file (name=(char *) 0xf7fffa67 "foo.c") (toplev.c line 966)
+#11 0x1bbb4 in main (argv=(char **) 0xf7fff98c, argc=5) (toplev.c line 1709)
+
+(gdb) p *insn
+$1 = {code = INSN, mode = VOIDmode, jump = 0, call = 0, unchanging = 0, volatil = 0, in_struct = 0, used = 0, integrated = 0, fld = {{rtint = 8, rtstr = 0x8 <Address 0x8 out of bounds>, rtx = 0x8, rtvec = 0x8, rttype = SFmode}}}
+(gdb)
+
+I am wondering why "nregs" in combine_instructions (#6) is so high on such a
+small program. This may have nothing to do with the bug.
+
+ John
+]
+
+*/
+
+
+short board[64];
+short Developed[1];
+
+ExaminePosition()
+{
+ Developed[0] = board[0] != 2;
+}
+
+
+
+/* main() added for test purposes. */
+main()
+{
+ int fail = 0;
+
+ board[0] = 5;
+ ExaminePosition();
+ if (Developed[0] != 1) {
+ printf("Test #1 failed, Developed[0] = %d\n", Developed[0]);
+ fail++;
+ }
+ board[0] = 2;
+ ExaminePosition();
+ if (Developed[0] != 0) {
+ printf("Test #2 failed, Developed[0] = %d\n", Developed[0]);
+ fail++;
+ }
+ if (fail == 0)
+ printf("Test passed\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu31.c b/gcc/testsuite/gcc.wendy/gnu31.c
new file mode 100755
index 0000000..c6ba4b5
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu31.c
@@ -0,0 +1,26 @@
+/*
+Message-Id: <9010022328.AA01576@shark2>
+To: cygint!bugs
+Subject: bug in gcc front end
+Date: Tue, 02 Oct 90 16:28:14 PDT
+From: @hermes.intel.com:kevins@shark2
+
+The following source program causes gcc to emit these errors:
+t1.c:3: bit-field `a' width not an integer constant
+t1.c:4: bit-field `b' width not an integer constant
+**** test ****/
+static struct b { /* 3.4 (cont.) */
+ int i;
+ unsigned int a : (1 + 3 * 2) / 7;
+ unsigned int b : (1 + 3 * 2) / 7;
+ } b;
+/**** end test ****
+This program is legal in that ANSI (well Dec 7, 1988) 3.5.2.1 grammar
+allows constant expressions here.
+*/
+
+#include <stdio.h>
+main()
+{
+ printf("Test passed.\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu4.c b/gcc/testsuite/gcc.wendy/gnu4.c
new file mode 100755
index 0000000..e8d2af9
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu4.c
@@ -0,0 +1,15 @@
+struct s {int x[5];};
+main()
+{
+ struct s {struct s *next; int i;};
+ static struct s sa[2];
+
+ /* bar(sa[0].next->x[4]); */
+ printf("Test passed (if it compiled)\n");
+ exit(0);
+ bar(sa[0].next->i);
+}
+
+bar(i)
+int i;
+{}
diff --git a/gcc/testsuite/gcc.wendy/gnu5.c b/gcc/testsuite/gcc.wendy/gnu5.c
new file mode 100755
index 0000000..58a52a8
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu5.c
@@ -0,0 +1,41 @@
+/*
+Date: 22 Dec 87 08:38:59 PST (Tuesday)
+Subject: Serious bug in gcc 1.16
+From: "James_L_Mayer.WBST128"@xerox.com
+To: bug-gcc@prep.ai.mit.edu
+Message-Id: <871222-084137-7045@Xerox>
+
+Here is a bug in release 1.16 of gcc running on a Sun3:
+
+Problem:
+ In assembler output, "pointer" is incremented twice for each iteration.
+ (when compiled optimized.)
+*/
+
+struct bits
+{
+ unsigned bit0: 1;
+ unsigned bit1: 1;
+} foo[2];
+
+alpha(pointer, count)
+ struct bits *pointer;
+ int count;
+{
+ while (--count >= 0)
+ {
+ pointer->bit0 = !pointer->bit0;
+ pointer++;
+ }
+
+ if (pointer == &foo[2])
+ printf("Test passed\n");
+ else
+ printf("FAILED, pointer=%x, &foo[2]=%x\n", pointer, &foo[2]);
+}
+
+main()
+{
+ alpha(foo, 2);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu6.c b/gcc/testsuite/gcc.wendy/gnu6.c
new file mode 100755
index 0000000..b88594b
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu6.c
@@ -0,0 +1,8 @@
+static int it1, it3;
+int i1 = 4, i2 = 7;
+main() {
+ if ( (it3 = (it1 = i1) + (it1 = i2)) == i1+i2 )
+ printf("Test passed\n");
+ else
+ printf("Failed...\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu7.c b/gcc/testsuite/gcc.wendy/gnu7.c
new file mode 100755
index 0000000..6842fd9
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu7.c
@@ -0,0 +1,8 @@
+#define Neg -113
+static unsigned int ui2 = Neg;
+main() {
+ if ( ui2/2 == ((unsigned)Neg)/2 )
+ printf("Test passed\n");
+ else
+ printf("Failed...\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu8.c b/gcc/testsuite/gcc.wendy/gnu8.c
new file mode 100755
index 0000000..e973d17
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu8.c
@@ -0,0 +1,8 @@
+#define Neg -113
+static unsigned int ui2 = Neg;
+main() {
+ if ( ui2%2 == ((unsigned)Neg)%2 )
+ printf("Test passed\n");
+ else
+ printf("Failed...\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/gnu9.c b/gcc/testsuite/gcc.wendy/gnu9.c
new file mode 100755
index 0000000..e42eb70
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/gnu9.c
@@ -0,0 +1,9 @@
+main() {
+ struct s {unsigned i9:9, i1:1;} x;
+ x.i9 = 0;
+ x.i1 = 3; /* Note: larger than bitfield */
+ if ( x.i9 == 0 )
+ printf("Test passed\n");
+ else
+ printf("Failed...\n");
+}
diff --git a/gcc/testsuite/gcc.wendy/wendy.dis b/gcc/testsuite/gcc.wendy/wendy.dis
new file mode 100755
index 0000000..2161a77
--- /dev/null
+++ b/gcc/testsuite/gcc.wendy/wendy.dis
@@ -0,0 +1,180 @@
+# Expect script for the GCC "Wendy" Regression Testsuite
+# Copyright (C) 1994 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 2 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 this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#
+# Written by Jeffrey Wheat (cassidy@cygnus.com)
+# and Doug Evans (dje@cygnus.com).
+#
+# Tests in this directory, when they pass, must either
+# 1) have an exit code of 0, or
+# 2) have "Test passed" in their output, or
+# 3) have the *first* line of the file be
+# /* DEJAGNU_CFLAGS:"flag1 flag2 ..." DEJAGNU_OUTPUT:"expected output" */
+# The delimiter " may be anything. The expected output is matched with
+# tcl's "string match" (using csh-like pattern matching).
+#
+# If the file needs special cflags, see (3) above.
+# We only look at the first line of the file, if you need to specify both, put
+# them both on the first line (order doesn't matter).
+
+# This testsuite won't run on cross targets (you can't always get the output
+# of printf back), and it has some portability problems, so it's disabled for
+# now. Since parts of it are "internal use only" (see README), what we need
+# to do is pull the pieces out of it that are good tests into another
+# framework. We still keep this testsuite around for those who might want to
+# run it, but keep the checked in version disabled (by having it's name not end
+# in ".exp".
+
+if { $tracelevel } then {
+ set strace $tracelevel
+}
+
+# initialize harness
+gcc_init
+
+#
+# wendy_first_line
+# Read the first line for DEJAGNU cflags and expected output parameters.
+# The format is "/* DEJAGNU_CFLAGS:<delim>flag1 flag2<delim> DEJAGNU_OUTPUT:<delim>...<delim> */"
+# We translate "\n" to newline so there can be many lines of output.
+#
+# CFLAGS and OUTPUT are the names of variables to store the results in.
+# Returns -1 if there is a DEJAGNU line but is badly formatted,
+# 1 if there is a (properly formatted) DEJAGNU line, 0 otherwise.
+#
+proc wendy_first_line { file cflags output } {
+ upvar $cflags my_cflags $output my_output
+ set fd [open $file r]
+ gets $fd line
+ close $fd
+ if [ string match "*DEJAGNU*" $line ] then {
+ # Fetch the delimiter.
+ verbose "$file has DEJAGNU line: $line" 4
+ regsub ".*DEJAGNU_\[A-Z\]*:(.).*" $line {\1} delim
+ # If there are no matches, there's a syntax error somewhere.
+ set match 0
+ # '\' is needed on the parens here because $delim(foo) means something.
+ # '\' is needed on the brackets because otherwise tcl will execute
+ # what's inbetween them (for you tcl newbies like me).
+ if [regsub ".*DEJAGNU_CFLAGS:$delim\(\[^$delim\]*\)$delim.*" $line {\1} tmp_cflags] then {
+ set my_cflags $tmp_cflags
+ set match 1
+ }
+ if [regsub ".*DEJAGNU_OUTPUT:$delim\(\[^$delim\]*\)$delim.*" $line {\1} tmp_output] then {
+ # Convert "\n" in expected output to newlines.
+ regsub -all "\\\\n" $tmp_output "\n" my_output
+ set match 1
+ }
+ if {$match == 0} then {
+ # Error in test case.
+ return -1
+ }
+ return 1
+ } else {
+ return 0
+ }
+}
+
+#
+# wendy_try
+# Try to run a testcase and report pass/fail.
+# CFLAGS is the cflags you want reported in the pass/fail message
+# (not all the cflags, just the exceptional ones).
+#
+proc wendy_try { testcase executable cflags expected_output } {
+ global exec_output
+
+ if ![file exists $executable] then {
+ gcc_fail $testcase $cflags
+ } else {
+ set status -1
+ set status [ eval gcc_load "$executable" ]
+ switch -- $status {
+ "0" {
+ catch "exec rm -f $executable"
+ gcc_pass $testcase $cflags
+ }
+ "1" {
+ # Allow test cases to have a non-zero exit code and still
+ # succeed if the output is correct.
+ if [string match $expected_output $exec_output] then {
+ catch "exec rm -f $executable"
+ gcc_pass $testcase $cflags
+ } else {
+ verbose "Expected $expected_output, got $exec_output" 4
+ # Leave executable in place.
+ gcc_fail $testcase $cflags
+ }
+ }
+ "-1" {
+ perror "Couldn't load $executable."
+ }
+ }
+ }
+}
+
+#
+# main test loop
+# Testcases needing additional compilation options, or have non-standard
+# output, provide $testcase.exp which defines $wendy_cflags and $wendy_output.
+#
+
+set wendy_options ""
+if [info exists CFLAGS] then {
+ append wendy_options " $CFLAGS"
+}
+if [info exists LIBS] then {
+ append wendy_options " $LIBS"
+}
+append wendy_options " -lm"
+
+foreach testcase [glob -nocomplain $srcdir/$subdir/*.c] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $testcase] then {
+ continue
+ }
+ set executable $tmpdir/[file tail [file rootname $testcase].x]
+
+ # Remove any existing executable.
+ catch "exec rm -f $executable"
+
+ # Reset the expected output and optional cflags.
+ set wendy_cflags ""
+ set wendy_output "Test passed*"
+
+ # See if the testcase has special needs.
+ set status [wendy_first_line $testcase wendy_cflags wendy_output]
+ switch -- $status {
+ "0" {}
+ "1" {}
+ "-1" {
+ perror "Error in $testcase, badly formatted DEJAGNU line."
+ }
+ }
+
+ # Compile the testcase.
+ gcc_start [list "$testcase" "-o $executable $wendy_options $wendy_cflags"]
+
+ # Run the executable if it exists.
+ wendy_try $testcase $executable "$wendy_cflags" "$wendy_output"
+}
+
+# call proc gcc_stat to print the testsuite pass/fail stats
+gcc_stat
+
+# Clean up.
+unset wendy_options
+gcc_finish