Initial revision


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..d122548
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,26 @@
+EXTRA_DIST = \
+	badaddrvalue.c badjump.c \
+	badloop.c bitfield1.c \
+	blocked_syscall.c clientperm.c \
+	clientstackperm.c coolo_sigaction.cpp \
+	coolo_strlen.c coolo_strlen.s \
+	cpuid_c.c cpuid_s.s \
+	doublefree.c errs1.c \
+	exitprog.c floored.c \
+	fprw.c fwrite.c \
+	inline.c inlineh.c \
+	inlineh.h malloc1.c \
+	malloc2.c manuel1.c \
+	manuel2.c manuel3.c \
+	memalign_test.c memcmptest.c \
+	memtests.cpp mmaptest.c \
+	oneparam.c pushfpopf_c.c \
+	pushfpopf.s rcl_assert.s \
+	rcrl.c readline1.c \
+	realloc1.c sha1.test.c \
+	shortpush.c shorts.c \
+	signal1.c signal2.c \
+	signal3.c smc1.c \
+	suppfree.c tronical.c \
+	tronical.s twoparams.c \
+	twoparams.s
\ No newline at end of file
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..93747f1
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,175 @@
+# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+DEFAULT_SUPP = @DEFAULT_SUPP@
+LN_S = @LN_S@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+
+EXTRA_DIST =  	badaddrvalue.c badjump.c 	badloop.c bitfield1.c 	blocked_syscall.c clientperm.c 	clientstackperm.c coolo_sigaction.cpp 	coolo_strlen.c coolo_strlen.s 	cpuid_c.c cpuid_s.s 	doublefree.c errs1.c 	exitprog.c floored.c 	fprw.c fwrite.c 	inline.c inlineh.c 	inlineh.h malloc1.c 	malloc2.c manuel1.c 	manuel2.c manuel3.c 	memalign_test.c memcmptest.c 	memtests.cpp mmaptest.c 	oneparam.c pushfpopf_c.c 	pushfpopf.s rcl_assert.s 	rcrl.c readline1.c 	realloc1.c sha1.test.c 	shortpush.c shorts.c 	signal1.c signal2.c 	signal3.c smc1.c 	suppfree.c tronical.c 	tronical.s twoparams.c 	twoparams.s
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES = 
+DIST_COMMON =  Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps tests/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = tests
+
+distdir: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am:  mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/badaddrvalue.c b/tests/badaddrvalue.c
new file mode 100644
index 0000000..1bb2047
--- /dev/null
+++ b/tests/badaddrvalue.c
@@ -0,0 +1,12 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ( void )
+{
+   char* aa = malloc(8);
+   aa[-1] = 17;
+   if (aa[-1] == 17) 
+      printf("17\n"); else printf("not 17\n");
+   return 0;
+}
diff --git a/tests/badjump.c b/tests/badjump.c
new file mode 100644
index 0000000..053663b
--- /dev/null
+++ b/tests/badjump.c
@@ -0,0 +1,6 @@
+
+int main ( void )
+{
+   char* p = (char*)0xE000000;
+   return ((int(*)(void)) p) ();
+}
diff --git a/tests/badloop.c b/tests/badloop.c
new file mode 100644
index 0000000..8780cf7
--- /dev/null
+++ b/tests/badloop.c
@@ -0,0 +1,15 @@
+
+#include <stdio.h>
+
+int main ( void )
+{
+   int a[5];
+   int i, s;
+   a[0] = a[1] = a[3] = a[4] = 0;
+   s = 0;
+   for (i = 0; i < 5; i++) 
+      s += a[i];
+   if (s == 377)
+      printf("sum is %d\n", s);
+   return 0;
+}
diff --git a/tests/bitfield1.c b/tests/bitfield1.c
new file mode 100644
index 0000000..4a7a61a
--- /dev/null
+++ b/tests/bitfield1.c
@@ -0,0 +1,18 @@
+
+#include <malloc.h>
+
+typedef
+   struct {
+      int          x;
+      unsigned int y:1;
+      int          z;
+   } 
+   Fooble;
+
+void main ( void )
+{
+   Fooble* f = malloc(sizeof(Fooble));
+   f->x = 1;
+   f->z = 1;
+   f->y = (f == (Fooble*)17 ? 1 : 0);
+}
diff --git a/tests/blocked_syscall.c b/tests/blocked_syscall.c
new file mode 100644
index 0000000..0ac9d5c
--- /dev/null
+++ b/tests/blocked_syscall.c
@@ -0,0 +1,32 @@
+
+#include <stdio.h>
+#include <unistd.h>
+#include <assert.h>
+#include <signal.h>
+
+int fds[2];
+
+void the_sighandler ( int signo )
+{
+   int nw;
+   //   assert(signo == SIGUSR1);
+   //   printf("sighandler running; should unblock now\n");
+   nw = write(fds[1], "zzz", 1);
+   //  assert(nw == 1);
+}
+
+int main ( void )
+{
+   char buf[10];
+   int res, nr;
+   void* oldsh = signal(SIGUSR1, the_sighandler);
+   assert(oldsh != SIG_ERR);
+   printf("pid = %d\n", getpid());
+   res = pipe(fds);
+   assert (res == 0);
+   printf("doing read(); this should block\n");
+   nr = read(fds[0], buf, 1);
+   /* blocks */
+   printf("read returned %d\n", nr);
+   return 0;
+}
diff --git a/tests/clientperm.c b/tests/clientperm.c
new file mode 100644
index 0000000..ee7809d
--- /dev/null
+++ b/tests/clientperm.c
@@ -0,0 +1,39 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "valgrind.h"
+
+int main1 ( void )
+{
+  int xxx, i;
+  for (i = 0; i < 10; i++) VALGRIND_CHECK_DEFINED(xxx);
+  return 0;
+}
+
+int main ( void )
+{
+   int i, sum, m;
+   char* aa = calloc(100,1);
+   sum = 0;
+
+   VALGRIND_CHECK_READABLE(aa,100);
+
+   m = VALGRIND_MAKE_WRITABLE( &aa[49], 1 );
+   VALGRIND_CHECK_WRITABLE(aa,100);
+
+   printf("m_na: returned value is %d\n", m );
+
+   for (i = 0; i < 100; i++)
+     sum += aa[i];
+   printf("sum is %d\n", sum);
+
+   m = VALGRIND_DISCARD(m);
+   printf("m_rm: returned value is %d\n", m );
+
+   for (i = 0; i < 100; i++)
+     sum += aa[i];
+   printf("sum is %d\n", sum);
+
+   return 0;
+}
diff --git a/tests/clientstackperm.c b/tests/clientstackperm.c
new file mode 100644
index 0000000..31a5010
--- /dev/null
+++ b/tests/clientstackperm.c
@@ -0,0 +1,36 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "valgrind.h"
+
+
+int baaaad ( void )
+{
+   int i;
+   int spacer0[10];
+   int aaa[10];
+   int spacer1[10];
+   int bbb[10];
+   int spacer2[10];
+   int ccc[10];
+   int spacer3[10];
+   VALGRIND_MAKE_NOACCESS_STACK(spacer0, sizeof spacer0);
+   VALGRIND_MAKE_NOACCESS_STACK(spacer1, sizeof spacer1);
+   VALGRIND_MAKE_NOACCESS_STACK(spacer2, sizeof spacer2);
+   VALGRIND_MAKE_NOACCESS_STACK(spacer3, sizeof spacer3);
+   printf("reading %p\n", &aaa[-3]);
+   return aaa[-3];
+   for (i = 0; i < 10; i++) {
+     printf("poking addr %p\n", & spacer1[i]);
+     spacer0[i] = spacer1[i] = spacer2[i] = spacer3[i] = 0;
+   }
+}
+
+
+int main ( void )
+{
+   int z = baaaad();
+   return 0;
+}
diff --git a/tests/coolo_sigaction.cpp b/tests/coolo_sigaction.cpp
new file mode 100644
index 0000000..b41938b
--- /dev/null
+++ b/tests/coolo_sigaction.cpp
@@ -0,0 +1,54 @@
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static struct sigaction oldChildHandlerData;
+
+void theHandler(int arg)
+{
+  printf("handled %d\n", arg);
+}
+
+void setupHandlers()
+{
+  struct sigaction act;
+  act.sa_handler=theHandler;
+  sigemptyset(&(act.sa_mask));
+  sigaddset(&(act.sa_mask), SIGCHLD);
+  // Make sure we don't block this signal. gdb tends to do that :-(
+  sigprocmask(SIG_UNBLOCK, &(act.sa_mask), 0);
+
+  act.sa_flags = SA_NOCLDSTOP;
+
+  // CC: take care of SunOS which automatically restarts interrupted system
+  // calls (and thus does not have SA_RESTART)
+
+#ifdef SA_RESTART
+  act.sa_flags |= SA_RESTART;
+#endif
+
+  sigaction( SIGCHLD, &act, &oldChildHandlerData );
+
+  act.sa_handler=SIG_IGN;
+  sigemptyset(&(act.sa_mask));
+  sigaddset(&(act.sa_mask), SIGPIPE);
+  act.sa_flags = 0;
+  sigaction( SIGPIPE, &act, 0L);
+}
+
+int main()
+{
+    int i;
+    char buffer[200];
+    setupHandlers();
+    FILE *p = popen("echo Hallo World", "r");
+    while (!feof(p)) {
+        int n = fread(buffer, 200, 1, p);
+        write(2, buffer, n);
+    }
+    fclose(p);
+    for (i = 0; i < 1000000; i++) ;
+    return 0;
+}
diff --git a/tests/coolo_strlen.c b/tests/coolo_strlen.c
new file mode 100644
index 0000000..16e9870
--- /dev/null
+++ b/tests/coolo_strlen.c
@@ -0,0 +1,13 @@
+
+#include <string.h>
+
+int main() {
+        char buffer[200] = "HALLO";
+        char *b2 = strdup(strcat(buffer, "THis is a very long strings"));
+        int len = strlen(b2);
+        if (len < 12)
+                return 0;
+        else
+                return 1;
+}
+
diff --git a/tests/coolo_strlen.s b/tests/coolo_strlen.s
new file mode 100644
index 0000000..6cadfcc
--- /dev/null
+++ b/tests/coolo_strlen.s
@@ -0,0 +1,90 @@
+	.file	"coolo_strlen.c"
+	.version	"01.01"
+gcc2_compiled.:
+.section	.rodata
+.LC0:
+	.string	"HALLO"
+.globl memset
+.LC1:
+	.string	"THis is a very long strings"
+.text
+	.align 4
+.globl main
+	.type	 main,@function
+main:
+	movl .LC0,%eax
+	pushl %ebp
+	movl %esp,%ebp
+	subl $216,%esp
+	movl %eax,-200(%ebp)
+	movw .LC0+4,%ax
+	movw %ax,-196(%ebp)
+	leal -194(%ebp),%eax
+	addl $-4,%esp
+	pushl $194
+	pushl $0
+	pushl %eax
+	call memset
+	addl $16,%esp
+	addl $-12,%esp
+	addl $-8,%esp
+	pushl $.LC1
+	leal -200(%ebp),%eax
+	pushl %eax
+	call strcat
+	addl $16,%esp
+	pushl %eax
+	call __strdup
+	movl %eax,%edx
+	movl %edx,%ecx
+	andl $3,%ecx
+	je .L105
+	jp .L110
+	cmpl $2,%ecx
+	je .L111
+	cmpb %ch,(%eax)
+	je .L109
+	incl %eax
+.L111:
+	cmpb %ch,(%eax)
+	je .L109
+	incl %eax
+.L110:
+	cmpb %ch,(%eax)
+	je .L109
+	incl %eax
+.L105:
+	movl (%eax),%ecx
+	testb %ch,%cl
+	jne .L106
+	testb %cl,%cl
+	je .L109
+	testb %ch,%ch
+	je .L108
+.L106:
+	testl $16711680,%ecx
+	je .L107
+	addl $4,%eax
+	testl $-16777216,%ecx
+	jne .L105
+	subl $3,%eax
+.L107:
+	incl %eax
+.L108:
+	incl %eax
+.L109:
+	subl %edx,%eax
+	cmpl $11,%eax
+	jle .L102
+	movl $1,%eax
+	jmp .L104
+	.p2align 4,,7
+.L102:
+	xorl %eax,%eax
+.L104:
+	movl %ebp,%esp
+	popl %ebp
+	ret
+.Lfe1:
+	.size	 main,.Lfe1-main
+	.ident	"GCC: (GNU) 2.95.3 20010315 (release)"
diff --git a/tests/cpuid_c.c b/tests/cpuid_c.c
new file mode 100644
index 0000000..333ff11
--- /dev/null
+++ b/tests/cpuid_c.c
@@ -0,0 +1,21 @@
+
+#include <stdio.h>
+
+// in cpuid_s.s
+extern void get_cpuid0 ( unsigned int* buf );
+extern void get_cpuid1 ( unsigned int* buf );
+
+unsigned int buf[4];
+
+int main ( void )
+{
+   get_cpuid0(&buf[0]);
+   printf("cpuid words (0): 0x%x 0x%x 0x%x 0x%x\n", 
+          buf[0], buf[1], buf[2], buf[3] );
+
+   get_cpuid1(&buf[0]);
+   printf("cpuid words (1): 0x%x 0x%x 0x%x 0x%x\n", 
+          buf[0], buf[1], buf[2], buf[3] );
+
+   return 0;
+}
diff --git a/tests/cpuid_s.s b/tests/cpuid_s.s
new file mode 100644
index 0000000..27bcc93
--- /dev/null
+++ b/tests/cpuid_s.s
@@ -0,0 +1,77 @@
+
+	
+	.file	"oneparam.c"
+	.version	"01.01"
+gcc2_compiled.:
+.text
+	.align 4
+
+.globl get_cpuid0
+	.type	 get_cpuid0,@function
+get_cpuid0:
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+
+	pushl	%edi
+	pushl	%eax
+	pushl	%ebx
+	pushl	%ecx
+	pushl	%edx
+
+	movl	%eax, %edi
+	movl	$0, %eax
+	cpuid	
+	movl	%eax, (%edi)
+	movl	%ebx, 4(%edi)
+	movl	%ecx, 8(%edi)
+	movl	%edx, 12(%edi)
+
+	popl	%edx
+	popl	%ecx
+	popl	%ebx
+	popl	%eax
+	popl	%edi
+	
+	popl	%ebp
+	ret
+.Lfe1:
+	.size	 get_cpuid0,.Lfe1-get_cpuid0
+
+
+.globl get_cpuid1
+	.type	 get_cpuid1,@function
+get_cpuid1:
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+
+	pushl	%edi
+	pushl	%eax
+	pushl	%ebx
+	pushl	%ecx
+	pushl	%edx
+
+	movl	%eax, %edi
+	movl	$1, %eax
+	cpuid	
+	movl	%eax, (%edi)
+	movl	%ebx, 4(%edi)
+	movl	%ecx, 8(%edi)
+	movl	%edx, 12(%edi)
+
+	popl	%edx
+	popl	%ecx
+	popl	%ebx
+	popl	%eax
+	popl	%edi
+	
+	popl	%ebp
+	ret
+.Lfe2:
+	.size	 get_cpuid1,.Lfe2-get_cpuid1
+
+
+
+
+	.ident	"GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-98)"
diff --git a/tests/doublefree.c b/tests/doublefree.c
new file mode 100644
index 0000000..3c27050
--- /dev/null
+++ b/tests/doublefree.c
@@ -0,0 +1,12 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ( void )
+{
+   int i;
+   void* p = malloc(177);
+   for (i = 0; i < 2; i++)
+     free(p);
+   return 0;
+}
diff --git a/tests/errs1.c b/tests/errs1.c
new file mode 100644
index 0000000..30d6cf6
--- /dev/null
+++ b/tests/errs1.c
@@ -0,0 +1,17 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+char* p;
+
+void ddd  ( void ) { p[-1] += 'z'; }
+void ccc  ( void ) { ddd(); }
+void bbb  ( void ) { ccc(); }
+void aaa  ( void ) { bbb(); }
+
+void zzzzzzz  ( void ) { p = malloc(10); }
+void yyy  ( void ) { zzzzzzz(); }
+void xxx  ( void ) { yyy(); }
+void www  ( void ) { xxx(); }
+
+void main ( void ) { www(); aaa(); }
diff --git a/tests/exitprog.c b/tests/exitprog.c
new file mode 100644
index 0000000..a3c2f4f
--- /dev/null
+++ b/tests/exitprog.c
@@ -0,0 +1,15 @@
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ZILLION 1000000
+
+void main ( void )
+{
+   int i;
+   char* a = malloc(ZILLION * sizeof(char));
+   for (i = 0; i <= ZILLION; i++) a[i] = 0;
+   a = (char*)177;
+   _exit(1);
+}
diff --git a/tests/floored.c b/tests/floored.c
new file mode 100644
index 0000000..9cdf8a6
--- /dev/null
+++ b/tests/floored.c
@@ -0,0 +1,17 @@
+
+#include <math.h>
+#include <stdio.h>
+
+int xToI ( );
+
+void main ( void )
+{
+   printf ( "the answer is %d\n", xToI () );
+}
+
+
+int xToI()
+{
+    return (int)floor(2.90) + 1;
+}
+
diff --git a/tests/fprw.c b/tests/fprw.c
new file mode 100644
index 0000000..556d8a0
--- /dev/null
+++ b/tests/fprw.c
@@ -0,0 +1,26 @@
+
+/* most of the nasties in this are in the same bb, so you need to run
+with --single-step=yes to get them properly distinguished. */
+
+#include <stdlib.h>
+
+int main ( void )
+{
+   volatile double d;
+   volatile float f;
+   double* dp = malloc(sizeof(double));
+   float* fp = malloc(sizeof(float));
+   int* ip = (int*)0x1234567;
+   d += 1.0;
+   f += 10.0;
+   *dp += 2.0;
+   *fp += 20.0;
+   free(dp);
+   free(fp);
+   *dp += 3.0;
+   *fp += 30.0;
+   free(ip);
+   ip = malloc(sizeof(int));
+   * ((double*)ip) = 1.2 + d;
+   return 0;
+}
diff --git a/tests/fwrite.c b/tests/fwrite.c
new file mode 100644
index 0000000..1eec4a4
--- /dev/null
+++ b/tests/fwrite.c
@@ -0,0 +1,9 @@
+
+#include <stdlib.h>
+#include <unistd.h>
+int main ( void )
+{
+   char* arr = malloc(10);
+   (void) write( 1 /* stdout */, arr, 10 );
+   return 0;
+}
diff --git a/tests/inline.c b/tests/inline.c
new file mode 100644
index 0000000..6db2fdd
--- /dev/null
+++ b/tests/inline.c
@@ -0,0 +1,20 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+__inline__
+static int addemup ( int* arr )
+{
+   int i, j = 0;
+   for (i = 0; i <= 10; i++)
+      j += arr[i];
+   return j;
+}
+
+void main ( void )
+{
+   int sum;
+   int* a = calloc(10, sizeof(int));
+   sum = addemup(a);
+   printf("sum is %d\n", sum);
+}
diff --git a/tests/inlineh.c b/tests/inlineh.c
new file mode 100644
index 0000000..f658065
--- /dev/null
+++ b/tests/inlineh.c
@@ -0,0 +1,23 @@
+
+#include <stdio.h>
+
+extern int burble ( int );
+
+__inline__
+static int inline_thisfile ( void )
+{
+   return burble(17);
+}
+
+#include "inlineh.h"
+
+void main ( void )
+{
+   int a;
+   a = 0;
+   a += inline_thisfile();
+   a *= 100;
+   a += inline_otherfile();
+   a /= 100;
+   printf("answer is %d\n", a);
+}
diff --git a/tests/inlineh.h b/tests/inlineh.h
new file mode 100644
index 0000000..e34172a
--- /dev/null
+++ b/tests/inlineh.h
@@ -0,0 +1,6 @@
+
+__inline__
+static int inline_otherfile ( void )
+{
+   return burble(19);
+}
diff --git a/tests/malloc1.c b/tests/malloc1.c
new file mode 100644
index 0000000..dff5250
--- /dev/null
+++ b/tests/malloc1.c
@@ -0,0 +1,24 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void really ( void );
+
+int main ( void )
+{ 
+   really();
+   return 0;
+}
+
+void really ( void )
+{
+   int i;
+   char* p = malloc(10);
+   for (i = 0; i < 10; i++)
+      p[i] = 'z';
+   free(p);
+   p[1] = 'z';
+   p = malloc(10);
+   p[2] = 'z';
+   p[-1] = 'z';
+}
diff --git a/tests/malloc2.c b/tests/malloc2.c
new file mode 100644
index 0000000..2d6a0ab
--- /dev/null
+++ b/tests/malloc2.c
@@ -0,0 +1,50 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* The original test driver machinery. */
+#define N_TEST_TRANSACTIONS 50000
+#define N_TEST_ARR 10000
+
+#define M_TEST_MALLOC 1000
+
+void* test_arr[N_TEST_ARR];
+
+int main ( int argc, char** argv )
+{
+   int i, j, k, nbytes;
+   unsigned char* chp;
+   char z;
+
+   for (i = 0; i < N_TEST_ARR; i++)
+      test_arr[i] = NULL;
+
+   for (i = 0; i < N_TEST_TRANSACTIONS; i++) {
+      j = random() % N_TEST_ARR;
+      if (test_arr[j]) {
+         free(test_arr[j]);
+         test_arr[j] = NULL;
+      } else {
+         nbytes = 1 + random() % M_TEST_MALLOC;
+         if (random()%64 == 32) 
+            nbytes *= 17;
+         test_arr[j] = malloc( nbytes );
+         chp = test_arr[j];
+         for (k = 1; k < nbytes; k++) 
+            chp[k] = (unsigned char)(k + 99);
+      }
+   }
+
+   for (i = 0; test_arr[i] == NULL; i++) ;
+   free(test_arr[i]);
+   ((char*)test_arr[i])[0] = 0;
+
+   for (i = 0; i < N_TEST_ARR; i++) {
+      if (test_arr[i]) {
+         free(test_arr[i]);
+         test_arr[i] = NULL;
+      }
+   }
+
+   return 0;
+}
diff --git a/tests/manuel1.c b/tests/manuel1.c
new file mode 100644
index 0000000..d56dfe2
--- /dev/null
+++ b/tests/manuel1.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <malloc.h>
+
+int main ()
+{
+  int x;
+
+  printf ("x = %d\n", x);
+}
diff --git a/tests/manuel2.c b/tests/manuel2.c
new file mode 100644
index 0000000..af362b4
--- /dev/null
+++ b/tests/manuel2.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <malloc.h>
+
+int main ()
+{
+  int *x;
+
+  printf ("x = %d\n", *x);
+}
diff --git a/tests/manuel3.c b/tests/manuel3.c
new file mode 100644
index 0000000..44ab712
--- /dev/null
+++ b/tests/manuel3.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <malloc.h>
+
+int main ()
+{
+  int *x, y;
+
+  x = (int *) malloc (sizeof (int));
+
+  y = *x == 173;
+
+  printf ("x = %d\n", y);
+}
diff --git a/tests/memalign_test.c b/tests/memalign_test.c
new file mode 100644
index 0000000..a24808c
--- /dev/null
+++ b/tests/memalign_test.c
@@ -0,0 +1,19 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int main ( void )
+{
+  void* a[10];
+  int i;
+  for (i = 0; i < 10; i++) {
+    a[i] = valloc(11111 * (i+1));
+    //    printf("I acquire %p\n", a[i]);
+  }
+  for (i = 0; i < 10; i++) {
+    //    printf("I release %p\n", a[i]);
+    free(a[i]);
+  }
+  free(a[9]);
+  return 0;
+}
diff --git a/tests/memcmptest.c b/tests/memcmptest.c
new file mode 100644
index 0000000..56dd85f
--- /dev/null
+++ b/tests/memcmptest.c
@@ -0,0 +1,19 @@
+
+#include <string.h>
+#include <stdio.h>
+
+char* s1;
+char* s2;
+
+int main ( void )
+{
+  s1 = malloc(10); strcpy(s1,"fooble");
+  s2 = malloc(10); strcpy(s2,"fooble");
+  if (memcmp(s1, s2, 8) != 0)
+    printf("different\n");
+  else
+    printf("same (?!)\n");
+  return 0;
+}
+
+	
diff --git a/tests/memtests.cpp b/tests/memtests.cpp
new file mode 100644
index 0000000..b5f2f3f
--- /dev/null
+++ b/tests/memtests.cpp
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+
+int main()
+{
+  int* fpointer = (int*)malloc(10);
+  delete fpointer; // should give warning
+  fpointer = (int*)malloc(10);
+  delete [] fpointer; // should give warning
+  fpointer = (int*)malloc(10);
+  free (fpointer); // should work!
+
+  int* nvec = new int[10];
+  delete nvec; // should give a warning
+  nvec = new int[10];
+  free (nvec); // should give a warning
+  nvec = new int[10];
+  delete [] nvec; // should work!
+
+  int* n = new int;
+  delete [] n; // should give a warning
+  n = new int;
+  free(n); // should give a warning
+  n = new int;
+  delete n; // should work!
+
+  free(0);
+
+  return 0;
+}
diff --git a/tests/mmaptest.c b/tests/mmaptest.c
new file mode 100644
index 0000000..4e52b1a
--- /dev/null
+++ b/tests/mmaptest.c
@@ -0,0 +1,15 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+int main()
+{
+    int fd;
+
+    mkdir("dir", 0666);
+    fd = open("dir", O_RDONLY);
+    mmap(NULL, 4711, PROT_READ, MAP_PRIVATE, fd, 0);
+    return 0;
+}
diff --git a/tests/oneparam.c b/tests/oneparam.c
new file mode 100644
index 0000000..648e304
--- /dev/null
+++ b/tests/oneparam.c
@@ -0,0 +1,10 @@
+
+/* general simple function to use as a template for assembly hacks */
+
+void fooble ( int* a )
+{
+   a[0] = 33;
+   a[1] = 44;
+   a[2] = 55;
+   a[3] = 66;
+}
diff --git a/tests/pushfpopf.s b/tests/pushfpopf.s
new file mode 100644
index 0000000..f140995
--- /dev/null
+++ b/tests/pushfpopf.s
@@ -0,0 +1,38 @@
+	.file	"twoparams.c"
+	.version	"01.01"
+gcc2_compiled.:
+.text
+	.align 4
+.globl fooble
+	.type	 fooble,@function
+fooble:
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+	
+	subl	12(%ebp), %eax
+	# flags are now undef if either operand is
+	# save possibly undef flags on stack
+	pushfl
+	
+	movl	$0, %eax
+	addl	$0, %eax
+	# flags are now definitely defined
+
+	popfl
+	# resulting flag definedness depends on outcome of sub above
+	# should override that created by 0 + 0 above
+	
+	# now use the condition codes to generate a value
+	# in a way which will cause undefinedness to get reported
+	jz	labelz
+	movl	$22, %eax
+	jmp	theend
+labelz:
+	movl	$33, %eax
+theend:	
+	popl	%ebp
+	ret
+.Lfe1:
+	.size	 fooble,.Lfe1-fooble
+	.ident	"GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-98)"
diff --git a/tests/pushfpopf_c.c b/tests/pushfpopf_c.c
new file mode 100644
index 0000000..f45271e
--- /dev/null
+++ b/tests/pushfpopf_c.c
@@ -0,0 +1,14 @@
+
+#include <stdio.h>
+
+// in pushfpopf.s
+extern int fooble ( int, int );
+
+int main ( void )
+{
+   int arr[2];
+   arr[0] = 3;
+   //   arr[1] = 45;
+   printf("fooble: result is %d\n", fooble(arr[0], arr[1]));
+   return 0;
+}
diff --git a/tests/rcl_assert.s b/tests/rcl_assert.s
new file mode 100644
index 0000000..303feae
--- /dev/null
+++ b/tests/rcl_assert.s
@@ -0,0 +1,8 @@
+
+                .text
+                .globl  main
+        main:
+                xorl    %eax, %eax
+                rcll    %eax
+                imull   %eax, %eax
+                ret
diff --git a/tests/rcrl.c b/tests/rcrl.c
new file mode 100644
index 0000000..115118d
--- /dev/null
+++ b/tests/rcrl.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+  int main (void)  
+  {
+    double U = 
+      ((double) 10586 / (double) 16119) + 
+      ((double) 37190 / (double) 108363);
+    printf ("x = %f\n", U);
+  
+    return 0;
+  }
+
diff --git a/tests/readline1.c b/tests/readline1.c
new file mode 100644
index 0000000..0d2c1a5
--- /dev/null
+++ b/tests/readline1.c
@@ -0,0 +1,25 @@
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+int rl_insert ( int, int );
+
+void main ( void )
+{
+   rl_insert(1, 'z');
+}
+
+int zzzstrlen ( char* str )
+{
+   if (str[1] == 0) return 2; else return 10;
+}
+
+int rl_insert ( int count, int c )
+{
+   char str[2];
+   str[1] = 0;
+   str[0] = c;
+   printf("HERE strlen  is %d\n", zzzstrlen(str));
+   return 0;
+}
diff --git a/tests/realloc1.c b/tests/realloc1.c
new file mode 100644
index 0000000..a5d1edc
--- /dev/null
+++ b/tests/realloc1.c
@@ -0,0 +1,14 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ( void )
+{
+   int i;
+   char* p = malloc(1);
+   for (i = 2; i < 50; i++) {
+      p = realloc(p, i);
+      p[i-1] = 'z';
+   }
+   return 0;
+}
diff --git a/tests/sha1.test.c b/tests/sha1.test.c
new file mode 100644
index 0000000..28b339f
--- /dev/null
+++ b/tests/sha1.test.c
@@ -0,0 +1,250 @@
+
+/*
+Stick the enclosed text in a file "sha1.test.c".
+
+Here is a sample run:
+    hugh $ cc sha1.test.c
+    hugh $ valgrind ./a.out
+    ==26189== valgrind-20020227, a memory error detector for x86 GNU/Linux.
+    ==26189== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
+    ==26189== For more details, rerun with: -v
+    ==26189== 
+
+    valgrind: vg_main.c:495 (vgPlain_create_translation_for): Assertion `trans_size > 0 && trans_size < 65536' failed.
+    Please report this bug to me at: jseward@acm.org
+
+    hugh $ valgrind --instrument=no ./a.out
+    ==26209== valgrind-20020227, a memory error detector for x86 GNU/Linux.
+    ==26209== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
+    ==26209== For more details, rerun with: -v
+    ==26209== 
+    ==26209== 
+
+*/
+
+/* ================ sha1.c ================ */
+/*
+SHA-1 in C
+By Steve Reid <steve@edmweb.com>
+100% Public Domain
+
+Test Vectors (from FIPS PUB 180-1)
+"abc"
+  A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
+"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
+  84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
+A million repetitions of "a"
+  34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
+*/
+
+/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */
+/* #define SHA1HANDSOFF * Copies data before messing with it. */
+
+#define SHA1HANDSOFF
+
+#include <string.h>
+#include <sys/types.h>	/* for u_int*_t */
+
+/* ================ sha1.h ================ */
+/*
+SHA-1 in C
+By Steve Reid <steve@edmweb.com>
+100% Public Domain
+*/
+
+typedef struct {
+    u_int32_t state[5];
+    u_int32_t count[2];
+    unsigned char buffer[64];
+} SHA1_CTX;
+
+void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]);
+void SHA1Init(SHA1_CTX* context);
+void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len);
+void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
+/* ================ end of sha1.h ================ */
+#include <endian.h>
+
+#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
+
+/* blk0() and blk() perform the initial expand. */
+/* I got the idea of expanding during the round function from SSLeay */
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
+    |(rol(block->l[i],8)&0x00FF00FF))
+#elif BYTE_ORDER == BIG_ENDIAN
+#define blk0(i) block->l[i]
+#else
+#error "Endianness not defined!"
+#endif
+#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
+    ^block->l[(i+2)&15]^block->l[i&15],1))
+
+/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
+#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
+#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
+#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
+#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
+#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
+
+
+/* Hash a single 512-bit block. This is the core of the algorithm. */
+
+void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64])
+{
+u_int32_t a, b, c, d, e;
+typedef union {
+    unsigned char c[64];
+    u_int32_t l[16];
+} CHAR64LONG16;
+#ifdef SHA1HANDSOFF
+CHAR64LONG16 block[1];  /* use array to appear as a pointer */
+    memcpy(block, buffer, 64);
+#else
+    /* The following had better never be used because it causes the
+     * pointer-to-const buffer to be cast into a pointer to non-const.
+     * And the result is written through.  I threw a "const" in, hoping
+     * this will cause a diagnostic.
+     */
+CHAR64LONG16* block = (const CHAR64LONG16*)buffer;
+#endif
+    /* Copy context->state[] to working vars */
+    a = state[0];
+    b = state[1];
+    c = state[2];
+    d = state[3];
+    e = state[4];
+    /* 4 rounds of 20 operations each. Loop unrolled. */
+    R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
+    R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
+    R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
+    R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
+    R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
+    R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
+    R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
+    R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
+    R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
+    R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
+    R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
+    R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
+    R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
+    R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
+    R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
+    R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
+    R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
+    R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
+    R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
+    R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+    /* Add the working vars back into context.state[] */
+    state[0] += a;
+    state[1] += b;
+    state[2] += c;
+    state[3] += d;
+    state[4] += e;
+    /* Wipe variables */
+    a = b = c = d = e = 0;
+#ifdef SHA1HANDSOFF
+    memset(block, '\0', sizeof(block));
+#endif
+}
+
+
+/* SHA1Init - Initialize new context */
+
+void SHA1Init(SHA1_CTX* context)
+{
+    /* SHA1 initialization constants */
+    context->state[0] = 0x67452301;
+    context->state[1] = 0xEFCDAB89;
+    context->state[2] = 0x98BADCFE;
+    context->state[3] = 0x10325476;
+    context->state[4] = 0xC3D2E1F0;
+    context->count[0] = context->count[1] = 0;
+}
+
+
+/* Run your data through this. */
+
+void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len)
+{
+u_int32_t i;
+u_int32_t j;
+
+    j = context->count[0];
+    if ((context->count[0] += len << 3) < j)
+	context->count[1]++;
+    context->count[1] += (len>>29);
+    j = (j >> 3) & 63;
+    if ((j + len) > 63) {
+        memcpy(&context->buffer[j], data, (i = 64-j));
+        SHA1Transform(context->state, context->buffer);
+        for ( ; i + 63 < len; i += 64) {
+            SHA1Transform(context->state, &data[i]);
+        }
+        j = 0;
+    }
+    else i = 0;
+    memcpy(&context->buffer[j], &data[i], len - i);
+}
+
+
+/* Add padding and return the message digest. */
+
+void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
+{
+unsigned i;
+unsigned char finalcount[8];
+unsigned char c;
+
+#if 0	/* untested "improvement" by DHR */
+    /* Convert context->count to a sequence of bytes
+     * in finalcount.  Second element first, but
+     * big-endian order within element.
+     * But we do it all backwards.
+     */
+    unsigned char *fcp = &finalcount[8];
+
+    for (i = 0; i < 2; i++)
+    {
+	u_int32_t t = context->count[i];
+	int j;
+
+	for (j = 0; j < 4; t >>= 8, j++)
+	    *--fcp = (unsigned char) t
+    }
+#else
+    for (i = 0; i < 8; i++) {
+        finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
+         >> ((3-(i & 3)) * 8) ) & 255);  /* Endian independent */
+    }
+#endif
+    c = 0200;
+    SHA1Update(context, &c, 1);
+    while ((context->count[0] & 504) != 448) {
+	c = 0000;
+        SHA1Update(context, &c, 1);
+    }
+    SHA1Update(context, finalcount, 8);  /* Should cause a SHA1Transform() */
+    for (i = 0; i < 20; i++) {
+        digest[i] = (unsigned char)
+         ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+    }
+    /* Wipe variables */
+    memset(context, '\0', sizeof(*context));
+    memset(&finalcount, '\0', sizeof(finalcount));
+}
+/* ================ end of sha1.c ================ */
+
+int
+main(int argc, char **argv)
+{
+    SHA1_CTX ctx;
+    unsigned char hash[20];
+
+    SHA1Init(&ctx);
+    SHA1Update(&ctx, "abc", 3);
+    SHA1Final(hash, &ctx);
+    return 0;
+}
+
+
diff --git a/tests/shortpush.c b/tests/shortpush.c
new file mode 100644
index 0000000..e91a268
--- /dev/null
+++ b/tests/shortpush.c
@@ -0,0 +1,15 @@
+
+typedef unsigned short UShort;
+
+UShort mul16 ( UShort a, UShort b );
+
+int main ( int argc, char** argv )
+{
+   UShort x = mul16 ( 10, 20 );
+   return ((int)x) - 200;
+}
+
+UShort mul16 ( UShort a, UShort b )
+{
+   return a * b;
+}
diff --git a/tests/shorts.c b/tests/shorts.c
new file mode 100644
index 0000000..034c706
--- /dev/null
+++ b/tests/shorts.c
@@ -0,0 +1,36 @@
+
+#include <stdio.h>
+
+typedef struct { short ot; short ob; short nt; short nb; } Stuff;
+
+void PaintThumb( Stuff* w )
+{
+    short oldtop = w->ot;
+    short oldbot = w->ob;
+    short newtop = w->nt;
+    short newbot = w->nb;
+
+        if (newtop < oldtop) { fprintf(stderr,"case1\n");
+	//	    FillArea(w, newtop, XawMin(newbot, oldtop), 1);
+	}
+	if (newtop > oldtop) { fprintf(stderr,"case2\n");
+	//	    FillArea(w, oldtop, XawMin(newtop, oldbot), 0);
+	}
+	if (newbot < oldbot) { fprintf(stderr,"case3\n");
+	//	    FillArea(w, XawMax(newbot, oldtop), oldbot, 0);
+	}
+	if (newbot > oldbot) { fprintf(stderr,"case4\n");
+	//	    FillArea(w, XawMax(newtop, oldbot), newbot, 1);
+	}
+}
+
+int main ( void )
+{
+  Stuff st;
+  st.ot = -332;
+  st.ob = -301;
+  st.nt = 0;
+  st.nb = 31;
+  PaintThumb( &st );
+  return 0;
+}
diff --git a/tests/signal1.c b/tests/signal1.c
new file mode 100644
index 0000000..68a5cad
--- /dev/null
+++ b/tests/signal1.c
@@ -0,0 +1,22 @@
+
+#include <stdio.h>
+#include <signal.h>
+
+volatile int spin;
+
+void sig_hdlr ( int signo )
+{
+   printf ( "caught signal\n" );
+   spin = 0;
+   printf ( "signal returns\n" );
+}
+
+void main ( void )
+{
+   spin = 1;
+   printf ( "installing sig handler\n" );
+   signal(SIGINT, sig_hdlr);
+   printf ( "entering busy wait\n" );
+   while (spin) { };
+   printf ( "exited\n" );
+}
diff --git a/tests/signal2.c b/tests/signal2.c
new file mode 100644
index 0000000..6892d33
--- /dev/null
+++ b/tests/signal2.c
@@ -0,0 +1,18 @@
+
+#include <stdio.h>
+#include <signal.h>
+
+void sig_hdlr ( int signo )
+{
+   printf ( "caught sig segv\n" );
+   exit(1);
+}
+
+void main ( void )
+{
+   printf ( "installing sig handler\n" );
+   signal(SIGSEGV, sig_hdlr);
+   printf ( "doing bad thing\n" );
+   * (int*) 0 = 0;
+   printf ( "exited normally ?!\n" );
+}
diff --git a/tests/signal3.c b/tests/signal3.c
new file mode 100644
index 0000000..e2b4d17
--- /dev/null
+++ b/tests/signal3.c
@@ -0,0 +1,33 @@
+
+#include <signal.h>
+#include <sys/time.h>
+#include <stdio.h>
+#include <assert.h>
+
+void hdp_tick ( int sigNo )
+{
+   int j;
+   printf("tick "); fflush(stdout);
+   for (j = 0; j < 10 * 5000; j++) ;
+   printf("tock\n");
+}
+
+void hdp_init_profiling ( void )
+{
+   struct itimerval value;
+   int ret;
+
+   value.it_interval.tv_sec  = 0;
+   value.it_interval.tv_usec = 50 * 1000;
+   value.it_value = value.it_interval;
+
+   signal(SIGPROF, hdp_tick);
+   ret = setitimer(ITIMER_PROF, &value, NULL);
+   assert(ret == 0);
+}
+
+void main ( void )
+{
+   hdp_init_profiling();
+   while (1) {}
+}
diff --git a/tests/smc1.c b/tests/smc1.c
new file mode 100644
index 0000000..398f88d
--- /dev/null
+++ b/tests/smc1.c
@@ -0,0 +1,72 @@
+
+/* Test Heimdall's ability to spot writes to code which has been
+   translated, and discard the out-of-date translations.
+
+   CORRECT output is
+
+      in p 0
+      in q 1
+      in p 2
+      in q 3
+      in p 4
+      in q 5
+      in p 6
+      in q 7
+      in p 8
+      in q 9
+
+  WRONG output (if you fail to spot code-writes to code[0 .. 4]) is
+
+      in p 0
+      in p 1
+      in p 2
+      in p 3
+      in p 4
+      in p 5
+      in p 6
+      in p 7
+      in p 8
+      in p 9
+*/
+
+#include <stdio.h>
+
+typedef unsigned int Addr;
+typedef unsigned char UChar;
+
+void q ( int n )
+{
+   printf("in q %d\n", n);
+}
+
+void p ( int n )
+{
+   printf("in p %d\n", n);
+}
+
+UChar code[100];
+
+/* Make `code' be JMP-32 dest */
+void set_dest ( Addr dest )
+{
+   unsigned int delta;
+   delta = dest - ((Addr)(&code[0]));
+   delta -= 5;
+   
+   code[0] = 0xE9;   /* JMP d32 */
+   code[1] = (delta & 0xFF);
+   code[2] = ((delta >> 8) & 0xFF);
+   code[3] = ((delta >> 16) & 0xFF);
+   code[4] = ((delta >> 24) & 0xFF);
+}
+
+void main ( void )
+{
+   int i;
+   for (i = 0; i < 10; i += 2) {
+      set_dest ( (Addr)&p );
+      (  (void (*)(int)) (&code[0])  ) (i);
+      set_dest ( (Addr)&q );
+      (  (void (*)(int)) (&code[0])  ) (i+1);
+   }
+}
diff --git a/tests/suppfree.c b/tests/suppfree.c
new file mode 100644
index 0000000..8298f02
--- /dev/null
+++ b/tests/suppfree.c
@@ -0,0 +1,30 @@
+
+#include <stdlib.h>
+
+void ddd ( char* x )
+{
+  free(x);
+  free(x);
+}
+
+void ccc (char* x)
+{
+  ddd(x);
+}
+
+void bbb (char* x)
+{
+  ccc(x);
+}
+
+void aaa (char* x)
+{
+  bbb(x);
+}
+
+int main ( void )
+{
+   char* x = malloc(10);
+   aaa(x);
+   return 0;
+}
diff --git a/tests/tronical.c b/tests/tronical.c
new file mode 100644
index 0000000..dabd83d
--- /dev/null
+++ b/tests/tronical.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+
+struct Foo
+{
+    int a1 : 1;
+    int a2 : 1;
+    int a3 : 1;
+    int a4 : 1;
+    int a5 : 1;
+    int a6 : 1;
+    int a7 : 1;
+    int bleh : 1;
+};
+
+struct Foo* foo;
+
+void set()
+{
+    foo->bleh = 1;
+}
+
+void get()
+{
+    if ( foo->bleh == 0 )
+	printf( "blieb\n" );
+}
+
+int main()
+{
+  foo = malloc(sizeof(struct Foo));
+    set();
+
+    get();
+
+    return 0;
+}
+
diff --git a/tests/tronical.s b/tests/tronical.s
new file mode 100644
index 0000000..ee17c09
--- /dev/null
+++ b/tests/tronical.s
@@ -0,0 +1,58 @@
+	.file	"tronical.c"
+	.version	"01.01"
+gcc2_compiled.:
+.text
+	.align 4
+.globl set
+	.type	 set,@function
+set:
+	pushl	%ebp
+	movl	foo, %eax
+	orb	$128, (%eax)
+	movl	%esp, %ebp
+	popl	%ebp
+	ret
+.Lfe1:
+	.size	 set,.Lfe1-set
+	.section	.rodata.str1.1,"ams",@progbits,1
+.LC0:
+	.string	"blieb\n"
+.text
+	.align 4
+.globl get
+	.type	 get,@function
+get:
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$8, %esp
+	movl	foo, %eax
+	cmpb	$0, (%eax)
+	js	.L4
+	subl	$12, %esp
+	pushl	$.LC0
+	call	printf
+	addl	$16, %esp
+.L4:
+	leave
+	ret
+.Lfe2:
+	.size	 get,.Lfe2-get
+	.align 4
+.globl main
+	.type	 main,@function
+main:
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$20, %esp
+	pushl	$4
+	call	malloc
+	movl	%eax, foo
+	call	set
+	call	get
+	xorl	%eax, %eax
+	leave
+	ret
+.Lfe3:
+	.size	 main,.Lfe3-main
+	.comm	foo,4,4
+	.ident	"GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-98)"
diff --git a/tests/twoparams.c b/tests/twoparams.c
new file mode 100644
index 0000000..91c966a
--- /dev/null
+++ b/tests/twoparams.c
@@ -0,0 +1,7 @@
+
+/* general simple function to use as a template for assembly hacks */
+
+int fooble ( int a, int b )
+{
+   return a - b;
+}
diff --git a/tests/twoparams.s b/tests/twoparams.s
new file mode 100644
index 0000000..5adfec5
--- /dev/null
+++ b/tests/twoparams.s
@@ -0,0 +1,17 @@
+	.file	"twoparams.c"
+	.version	"01.01"
+gcc2_compiled.:
+.text
+	.align 4
+.globl fooble
+	.type	 fooble,@function
+fooble:
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+	subl	12(%ebp), %eax
+	popl	%ebp
+	ret
+.Lfe1:
+	.size	 fooble,.Lfe1-fooble
+	.ident	"GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-98)"