From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Camm Maguire <camm@debian.org>
Date: Jul, 16 2026 16:48:46 +0000
Subject: [PATCH] <short summary of the patch>

TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-<Vendor>: <vendor-bugtracker-url>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>

--- gcl27-2.7.1.orig/Makefile.am
+++ gcl27-2.7.1/Makefile.am
@@ -259,6 +259,9 @@ unixport/saved_%: | unixport/raw_% unixp
 		( ! echo $@ | grep -q _gprof$$ || echo "(setq compiler::*default-prof-p* t)" >prof_init.lsp ) && \
 		echo "(system:save-system \"../$@\")" | \
 		cat ../unixport/init_raw.lsp prof_init.lsp - | \
+			GCL_DISABLE_ASLR=t \
+			GCL_MULTIPROCESS_MEMORY_POOL= \
+			GCL_MEM_BOUND=29 \
 			GCL_LSPSYSDIR=../$(srcdir)/unixport/ \
 				../unixport/raw_$* unixport/ -libdir ./  && \
 		rm -f ../unixport/gcl_cmpnopt.lsp
@@ -581,7 +584,7 @@ gcl-tk/%.o: gcl-tk/%.lsp | unixport/save
 CLEANFILES+=gcl-tk/demos/index.lsp gcl-tk/demos/gc-monitor.o
 gcl-tk/demos/index.lsp: gcl-tk/tkl.o | unixport/saved_gcl
 	[ -d $(@D) ] || mkdir -p $(@D)
-	cd $(@D) && echo "(load \"../../$<\")(tk::get-autoloads (directory \"*.lisp\"))" | ../../$|
+	cd $(@D) && echo "(load \"../../$<\")(tk::get-autoloads)" | ../../$|
 
 sb_cmpnew/gcl_collectfn.o: cmpnew/gcl_collectfn.lsp | unixport/saved_gcl
 	[ -d $(@D) ] || mkdir -p $(@D)
--- gcl27-2.7.1.orig/Makefile.in
+++ gcl27-2.7.1/Makefile.in
@@ -4598,6 +4598,9 @@ unixport/saved_%: | unixport/raw_% unixp
 		( ! echo $@ | grep -q _gprof$$ || echo "(setq compiler::*default-prof-p* t)" >prof_init.lsp ) && \
 		echo "(system:save-system \"../$@\")" | \
 		cat ../unixport/init_raw.lsp prof_init.lsp - | \
+			GCL_DISABLE_ASLR=t \
+			GCL_MULTIPROCESS_MEMORY_POOL= \
+			GCL_MEM_BOUND=29 \
 			GCL_LSPSYSDIR=../$(srcdir)/unixport/ \
 				../unixport/raw_$* unixport/ -libdir ./  && \
 		rm -f ../unixport/gcl_cmpnopt.lsp
@@ -4899,7 +4902,7 @@ gcl-tk/%.o: gcl-tk/%.lsp | unixport/save
 	$(word 1,$|) -compile $< -o $@
 gcl-tk/demos/index.lsp: gcl-tk/tkl.o | unixport/saved_gcl
 	[ -d $(@D) ] || mkdir -p $(@D)
-	cd $(@D) && echo "(load \"../../$<\")(tk::get-autoloads (directory \"*.lisp\"))" | ../../$|
+	cd $(@D) && echo "(load \"../../$<\")(tk::get-autoloads)" | ../../$|
 
 sb_cmpnew/gcl_collectfn.o: cmpnew/gcl_collectfn.lsp | unixport/saved_gcl
 	[ -d $(@D) ] || mkdir -p $(@D)
--- gcl27-2.7.1.orig/cmpnew/gcl_cmpeval.lsp
+++ gcl27-2.7.1/cmpnew/gcl_cmpeval.lsp
@@ -650,7 +650,7 @@
 (defun lit-inl2 (form &aux (lf (eq 'lit (car form))))
   (list (this-safety-level)
 	(mapcar (lambda (x) (assert (eq (car x) 'ub)) (third x)) (when lf (fifth form)))
-	(cons (when lf (third form)) (info-type (cadr form)))
+	(cons (when lf (third form)) (ensure-known-type (info-type (cadr form))))
 	(ninth form)
 	(if lf (remove-comment (fourth form)) "")))
 
@@ -685,12 +685,15 @@
        (let ((i -1)) (mapcan (lambda (x &aux (y (incf i))) (unless (atomic-tp x) (list y))) tps))
        tr)))
 
+(defun tr-unused-tps (tr tps &aux (i -1))
+  (mapcar (lambda (x) (if (member (incf i) tr) t x)) tps))
+
 (defun ?update-fm-propagator (fm cl tr tps)
   (when (symbolp (car cl))
     (when (get (car cl) 'type-propagator);?more
       (when (eq (car fm) 'lit)
 	(when (member-if 'integerp tr) ;otherwise no point
-	  (push (list (car cl) tr tps) (ninth fm)))))))
+	  (push (list (car cl) tr (tr-unused-tps tr tps)) (ninth fm)))))))
 
 (defun merge-inl (cl inl pl &aux (tps (pop inl))(tr (pop inl)))
   (let ((z (member-if (lambda (x) (can-coalesce x tr inl tps)) (car pl))))
@@ -705,7 +708,7 @@
   (mapc (lambda (x) (merge-inl cl x pl)) inls))
 
 (defun ?add-inl (cl fms fm)
-  (let* ((tps (mapcar (lambda (x) (info-type (caddr x))) fms))
+  (let* ((tps (mapcar (lambda (x) (ensure-known-type (info-type (caddr x)))) fms))
 	 (tr (mapcar (lambda (x &aux (v (car (last x))))
 		       (when (and (consp v) (eq (car v) 'var))
 			 (position (cddr v) fms :key 'cdddr :test 'equalp)));FIXME
@@ -719,8 +722,6 @@
       (si::string-concatenate "/* " (prin1-to-string form) " */" (remove-comment s))
       s))
 
-(defvar *apply-inl-hash* t)
-
 (defun update-info-type-from-inl (i inl fms &aux (tps (mapcar (lambda (x) (info-type (caddr x))) fms)))
   (setf (info-type i)
 	(reduce 'type-and
@@ -745,8 +746,14 @@
     (mapc (lambda (y) (?update-fm-propagator x y tr (caddr y)))
 	  (sixth inl))))
 
+(defvar *block-apply-inl* nil)
+
+(defun block-apply-inl (cl)
+  (if (listp *block-apply-inl*)
+      (member (car cl) *block-apply-inl*)
+      t))
 
-(defun apply-inl (cl fms &aux (inl (when *apply-inl-hash* (inls-match cl fms))))
+(defun apply-inl (cl fms &aux (inl (unless (block-apply-inl cl) (inls-match cl fms))))
   (when inl
     (let* ((c1fms (mapcar (lambda (x) (cdr (nth x fms))) (second inl))))
       (unless (member-if-not (lambda (x)
@@ -769,7 +776,7 @@
 (defvar *ncompiles* 0)
 
 (defun try-compile (nm s tps
-		    &aux (*sig-discovery* t)
+		    &aux (*sig-discovery* t) si::*sig-discovery-props*
 		      *compile-verbose*
 		      (syms (mapcar (lambda (x) (declare (ignore x)) (gensym)) tps)))
   (incf *ncompiles*)
@@ -798,7 +805,8 @@
 	(car inls)))
 
 (defun iterate-over-inls (nm at &optional (it 0)
-			  &aux (inls (copy-tree (get-inl-list (list nm))))
+			  &aux (*block-apply-inl* (list nm))
+			    (inls (copy-tree (get-inl-list (list nm))))
 			    (have-2 (member 2 (car inls) :key 'caddr)))
 
   (flet ((try (s tps chg) ;(print (list 'trying nm s (mapcar 'cmp-unnorm-tp tps)))
@@ -807,6 +815,7 @@
 	     (print (list nm s (mapcar 'cmp-unnorm-tp tps) chg))
 	     (return-from iterate-over-inls (iterate-over-inls nm at (1+ it))))))
     (mapc (lambda (inl &aux (tps (copy-list (car inl))))
+	    (try (caddr inl) (car inl) (list 'no-mod))
 	    (when (eql 0 (caddr inl))
 	      (try 1 (car inl) (list 0 '-> 1)))
 	    (mapl (lambda (ptp pstp &aux (tp (car ptp))(stp (car pstp)))
@@ -830,6 +839,21 @@
 	  (car inls))
     it))
 
+(defun seed-all-inls (&aux r)
+  (declare (dynamic-extent r))
+  (do-all-symbols (s)
+    (unless (gethash s *inl-hash*)
+      (when (fboundp s)
+	(unless (or (macro-function s) (special-operator-p s))
+	  (when (get-return-type s)
+	    (unless (member s r)
+	      (pushnew s r)
+	      (let ((at (get-arg-types s)))
+	      (print s)
+	      (try-compile s 0
+			   (make-list (length (ldiff at (member '* at)))
+				      :initial-element t))))))))))
+
 (defun finalize-inls (nm &aux (*ncompiles* 0)(at (get-arg-types nm))(inls (get-inl-list (list nm))))
   (restrict-inl-1-tps nm at inls)
   (list (iterate-over-inls nm at) *ncompiles*  (show-inls nm)))
@@ -840,12 +864,14 @@
 	     (unless (zerop (car (finalize-inls x)))
 	       (setq redo t)))
 	   *inl-hash*)
-  (when redo
-    (finalize-all-inls)))
+  (when redo (finalize-all-inls)))
+
+(defun finalize-inl-hash nil
+  (seed-all-inls)
+  (finalize-all-inls))
 
 (defun dump-inl-hash (f &optional finalize &aux (si::*print-package* t))
-  (when finalize (finalize-all-inls))
-;  (when compress (maphash (lambda (x y) (declare (ignore y)) (compress-inl x)) *inl-hash*))
+  (when finalize (finalize-inl-hash))
   (with-open-file (s f :direction :output)
     (prin1 '(in-package :compiler) s)
     (terpri s)
--- gcl27-2.7.1.orig/cmpnew/gcl_cmptype.lsp
+++ gcl27-2.7.1/cmpnew/gcl_cmptype.lsp
@@ -871,7 +871,8 @@
 (si::putprop 'random 'random-propagator 'type-propagator)
 
 (defun lgcd2-propagator (f t1 t2 t3
-			 &aux (a1 (car (atomic-tp t1)))(a2 (car (atomic-tp t2)))
+			 &aux (t1 (type-and #tinteger t1))(t2 (type-and #tinteger t2))(t3 (type-and #tinteger t3))
+			   (a1 (car (atomic-tp t1)))(a2 (car (atomic-tp t2)))
 			   (a3 (car (atomic-tp t3))))
   (cond ((and a1 a2 a3) (object-type (funcall f a1 a2 a3)))
 	((type-and #t(not (integer 0 0)) (super-range '* #t(integer 0 1) (super-range 'min t1 t2))))))
--- gcl27-2.7.1.orig/cmpnew/gcl_lfun_list.lsp
+++ gcl27-2.7.1/cmpnew/gcl_lfun_list.lsp
@@ -18,6 +18,7 @@
 ;	     (((t) t) . si::type-of-c)
 ;	     (((list) t) . si::cons-car)
 ;	     (((list) t) . si::cons-cdr)
+	     (((structure) symbol) . structure-name)
 	     (((t t) cons) . cons)
 	     (((*) si::proper-list) . list)
 	     (((t *) list) . list*)
@@ -33,6 +34,7 @@
 	     (((real *) (returns-exactly real real)) . ceiling)
 	     (((real *) (returns-exactly real real)) . truncate)
 	     (((real *) (returns-exactly real real)) . round)
+	     ((((or (integer 1) (float (0))) *) (or (integer 0) (float 0))) . random)
 ;	     (((cons t) cons) . rplaca)
 ;	     (((cons t) cons) . rplacd)
 ;	     (((symbol) boolean) . boundp)
--- gcl27-2.7.1.orig/gcl-tk/guis.c
+++ gcl27-2.7.1/gcl-tk/guis.c
@@ -273,7 +273,7 @@ char *envp[];
             {
                 dfprintf(stderr, "guis,vforked child : %d\n", p);
 
-                _exit(p);
+                _exit(0);
                 /*
                    return p;
                    */
--- gcl27-2.7.1.orig/gcl-tk/tkl.lisp
+++ gcl27-2.7.1/gcl-tk/tkl.lisp
@@ -1487,18 +1487,15 @@ on ~a as in: ~s~%" host command )))
   (setf (msg-index) (the fixnum (+ m 1)))
   m)
 
-(defun get-autoloads (&optional (lis (directory "*.lisp")) ( out "index.lsp")
-				&aux *paths*
-				)
-  (declare (special *paths*))
+(defun get-autoloads (&optional
+			(lis (sort (directory "*.lisp") 'string<= :key 'namestring))
+			(out "index.lsp"))
   (with-open-file
    (st out :direction :output)
    (format st "~%(in-package ~s)" (package-name *package*))
    (dolist (v lis) (get-file-autoloads v st))
    (format st "~%(in-package ~s)" (package-name *package*))
-   ;(format st "~2%~s" `(setq si::*load-path* (append ',*paths* si::*load-path*)))
-
-   ))
+   (format st "~%(push (namestring (make-pathname :directory (pathname-directory *load-pathname*))) si::*load-path*)")))
 
 
 		  
@@ -1506,16 +1503,10 @@ on ~a as in: ~s~%" host command )))
 				&aux (eof '(nil))
 				(*package* *package*)
 				saw-package
-				name  )
-  (declare (special *paths*))
+				name)
   (setq name (pathname-name (pathname file)))
   (with-open-file
    (st file)
-   (if (boundp '*paths*)
-       (pushnew (namestring (make-pathname :directory
-					   (pathname-directory
-					    (truename st))))
-		*paths* :test 'equal))
    (sloop for tem = (read st nil eof)
 	  while (not (eq tem eof))
 	  do (cond ((and (consp tem) (eq (car tem) 'defun))
--- gcl27-2.7.1.orig/git.tag
+++ gcl27-2.7.1/git.tag
@@ -1 +1 @@
-"Version_2_7_2pre35"
+"Version_2_7_2pre36"
--- gcl27-2.7.1.orig/h/386-macosx.h
+++ gcl27-2.7.1/h/386-macosx.h
@@ -115,7 +115,6 @@ do {
  } while (0)
 
 #ifdef _LP64
-#define C_GC_OFFSET 4
 #include <mach-o/x86_64/reloc.h>
 #define RELOC_H "mach64_i386_reloc.h"
 #else
--- gcl27-2.7.1.orig/h/aarch64-macosx.h
+++ gcl27-2.7.1/h/aarch64-macosx.h
@@ -114,7 +114,6 @@ do {
   (a_) = fub;						    \
  } while (0)
 
-#define C_GC_OFFSET 4
 #include <mach-o/arm64/reloc.h>
 #define RELOC_H "mach64_aarch64_reloc.h"
 
--- gcl27-2.7.1.orig/h/amd64-kfreebsd.h
+++ gcl27-2.7.1/h/amd64-kfreebsd.h
@@ -8,9 +8,6 @@
 #define	I386
 #define SGC
 
-/* Apparently stack pointers can be 4 byte aligned, at least &argc -- CM */
-#define C_GC_OFFSET 4
-
 #define RELOC_H "elf64_i386_reloc.h"
 
 #define BRK_DOES_NOT_GUARANTEE_ALLOCATION
--- gcl27-2.7.1.orig/h/amd64-linux.h
+++ gcl27-2.7.1/h/amd64-linux.h
@@ -7,9 +7,6 @@
 #define	I386
 #define SGC
 
-/* Apparently stack pointers can be 4 byte aligned, at least &argc -- CM */
-#define C_GC_OFFSET 4
-
 #define RELOC_H "elf64_i386_reloc.h"
 #define MAX_CODE_ADDRESS (1L<<31)/*large memory model broken gcc 4.8*/
 #define MAX_DEFAULT_MEMORY_MODEL_CODE_ADDRESS (1UL<<31)
--- gcl27-2.7.1.orig/h/att_ext.h
+++ gcl27-2.7.1/h/att_ext.h
@@ -171,6 +171,7 @@ EXTER char **ARGV;
 #ifdef UNIX
 EXTER char **ENVP;
 #endif
+EXTER struct stat ss;
 
 EXTER object sSAsystem_directoryA;
 #ifdef UNIX
--- gcl27-2.7.1.orig/h/loongarch64-linux.h
+++ gcl27-2.7.1/h/loongarch64-linux.h
@@ -2,9 +2,6 @@
 
 #define SGC
 
-/* Apparently stack pointers can be 4 byte aligned, at least &argc -- CM */
-#define C_GC_OFFSET 4
-
 #define RELOC_H "elf64_loongarch64_reloc.h"
 #define SPECIAL_RELOC_H "elf64_loongarch64_reloc_special.h"
 /* #define MAX_CODE_ADDRESS (1L<<31)/\*large memory model broken gcc 4.8*\/ */
--- gcl27-2.7.1.orig/h/pool.h
+++ gcl27-2.7.1/h/pool.h
@@ -63,7 +63,6 @@ open_pool(void) {
 
   if (pool==-1) {
 
-    struct stat ss;
     massert(!lstat(multiprocess_memory_pool,&ss));
     massert(S_ISDIR(ss.st_mode));
 
--- gcl27-2.7.1.orig/h/powerpc-linux.h
+++ gcl27-2.7.1/h/powerpc-linux.h
@@ -21,5 +21,4 @@
 #define SPECIAL_RELOC_H "elf64_ppcle_reloc_special.h"
 #endif
 #define OUTPUT_MACH bfd_mach_ppc64
-#define C_GC_OFFSET 4
 #endif
--- gcl27-2.7.1.orig/h/protoize.h
+++ gcl27-2.7.1/h/protoize.h
@@ -1671,6 +1671,6 @@ object quick_call_function_vec(object,uf
 int msbrk_initialized(void);
 void *mdlopen(const char *,int);
 void set_global_env_defaults(void);
-void disable_aslr(int,char **,char **);
+void maybe_disable_aslr(int,char **,char **);
 void set_leak_malloc_on(void);
 void set_leak_malloc_off(void);
--- gcl27-2.7.1.orig/h/riscv64-linux.h
+++ gcl27-2.7.1/h/riscv64-linux.h
@@ -2,9 +2,6 @@
 
 #define SGC
 
-/* Apparently stack pointers can be 4 byte aligned, at least &argc -- CM */
-#define C_GC_OFFSET 4
-
 #define RELOC_H "elf64_riscv64_reloc.h"
 /* #define MAX_CODE_ADDRESS (1L<<31)/\*large memory model broken gcc 4.8*\/ */
 
--- gcl27-2.7.1.orig/h/s390-linux.h
+++ gcl27-2.7.1/h/s390-linux.h
@@ -3,7 +3,6 @@
 #define SGC
 
 #if SIZEOF_LONG == 8
-#define C_GC_OFFSET 4
 #define RELOC_H "elf64_s390_reloc.h"
 #define SPECIAL_RELOC_H "elf64_sparc_reloc_special.h"
 #define OUTPUT_MACH bfd_mach_s390_64
--- gcl27-2.7.1.orig/h/sparc-linux.h
+++ gcl27-2.7.1/h/sparc-linux.h
@@ -14,8 +14,4 @@
 #define SPECIAL_RELOC_H "elf64_sparc_reloc_special.h"
 #endif
 
-/* #if SIZEOF_LONG == 8 */
-/* #define C_GC_OFFSET 4 */
-/* #endif */
-
 #define OUTPUT_MACH bfd_mach_sparc_v9
--- gcl27-2.7.1.orig/o/cmpaux.c
+++ gcl27-2.7.1/o/cmpaux.c
@@ -659,7 +659,6 @@ find_init_name1(char *s,unsigned len) {
   return find_init_string(tmp);
 
 #else    
-  struct stat ss;
   char *tmp,*q;
   FILE *f;
 
--- gcl27-2.7.1.orig/o/disable_aslr.c
+++ gcl27-2.7.1/o/disable_aslr.c
@@ -1,7 +1,5 @@
 #include "include.h"
 
-#ifdef DISABLE_ASLR
-
 #if defined(__APPLE__)
 
 #include <stdio.h>
@@ -15,11 +13,16 @@
 #endif
 
 void
-disable_aslr(int argc, char **argv, char **envp) {
+maybe_disable_aslr(int argc, char **argv, char **envp) {
 
   pid_t pid;
   posix_spawnattr_t attr;
 
+#ifndef DISABLE_ASLR
+  if (!getenv("GCL_DISABLE_ASLR"))
+    return;
+#endif
+
   if (!_dyld_get_image_vmaddr_slide(0)) {
     return;
   }
@@ -88,11 +91,16 @@ reexec(int argc, char **argv, char **env
 #include <unistd.h>
 
 void
-disable_aslr(int argc, char **argv, char **envp) {
+maybe_disable_aslr(int argc, char **argv, char **envp) {
 
   long pers;
   long flag = ADDR_NO_RANDOMIZE|(sizeof(flag)==4 ? ADDR_COMPAT_LAYOUT : 0);
 
+#ifndef DISABLE_ASLR
+  if (!getenv("GCL_DISABLE_ASLR"))
+    return;
+#endif
+
   massert((pers=personality(-1))!=-1);
 
   /*READ_IMPLIES_EXEC is for selinux, but selinux will reset it in the child*/
@@ -114,11 +122,16 @@ disable_aslr(int argc, char **argv, char
 #include <sys/procctl.h>
 
 void
-disable_aslr(int argc, char **argv, char **envp) {
+maybe_disable_aslr(int argc, char **argv, char **envp) {
 
   const int cctl=PROC_ASLR_FORCE_DISABLE;
   int stat,ctl=cctl;
 
+#ifndef DISABLE_ASLR
+  if (!getenv("GCL_DISABLE_ASLR"))
+    return;
+#endif
+
   massert(procctl(P_PID, 0, PROC_ASLR_STATUS, &stat) != -1);
 
   if ((stat&cctl)!=cctl && !getenv("GCL_UNRANDOMIZE")) {
@@ -136,12 +149,10 @@ disable_aslr(int argc, char **argv, char
 #else  /*Unneeded on Hurd, cygwin/mingw via coff header flag*/
 
 void
-disable_aslr(int argc, char **argv, char **envp) {
+maybe_disable_aslr(int argc, char **argv, char **envp) {
   return;
 }
 
 #endif
 
-#endif
-
 #endif
--- gcl27-2.7.1.orig/o/file.d
+++ gcl27-2.7.1/o/file.d
@@ -257,7 +257,6 @@ open_stream(object fn,enum smmode smm, o
 
     if (!(fp=*FN1=='|' ? popen(FN1+1,"r") : fopen_not_dir(FN1,"r")) && sSAallow_gzipped_fileA->s.s_dbind!=Cnil) {
 
-      struct stat ss;
       massert(snprintf(FN2,sizeof(FN2),"%s.gz",FN1)>0);
 
       if (!stat(FN2,&ss)) {
--- gcl27-2.7.1.orig/o/gprof.c
+++ gcl27-2.7.1/o/gprof.c
@@ -1,9 +1,21 @@
+#include <dlfcn.h>
+
 #include "include.h"
 #include "page.h"
 #include "ptable.h"
 
-
 static unsigned long gprof_on;
+static void (*real_mcount)(void);
+
+void __attribute__((no_instrument_function))
+mcount(void) {
+
+  if (__builtin_expect(!gprof_on,1))
+    return;
+
+  real_mcount();
+
+}
 
 /*all but this stub to be written in the future provided*/
 #if defined(__APPLE__)
@@ -44,6 +56,8 @@ DEFUN("MONSTARTUP",object,fSmonstartup,S
     return Cnil;
 
   writable_malloc_wrap(my_monstartup,int,start,end);
+  if (__builtin_expect(!real_mcount,0))
+    massert(real_mcount=dlsym(RTLD_NEXT,"mcount"));
   gprof_on=1;
 
   return Ct;
@@ -54,6 +68,7 @@ void
 gprof_cleanup(void) {
 
   FFN(fSmcleanup)();
+  real_mcount=NULL;
 
 }
 
--- gcl27-2.7.1.orig/o/hash.d
+++ gcl27-2.7.1/o/hash.d
@@ -79,7 +79,7 @@ static ufixnum
 ufixhash(ufixnum g) {
   ufixnum i,h;
   for (h=i=0;i<sizeof(g);g>>=CHAR_SIZE,i++)
-    h^=rtb[g&MASK(CHAR_SIZE)];
+    h^=rtb[(g+i)&MASK(CHAR_SIZE)];
   return h;
 }
 
@@ -200,11 +200,11 @@ BEGIN:
 
 	for (;u<ue;) {
 	  ufixnum v=(*u++)>>s;
-	  if (u<ue||m) {
+	  if (s&&(u<ue||m)) {
 	    ufixnum w=(*u);
 	    if (u==ue)
 	      w&=BIT_MASK(m);
-	    v|=w<<(sizeof(*u)-s);
+	    v|=w<<(BV_BITS-s);
 	  }
 	  h^=ufixhash(v);
 	}
@@ -276,11 +276,11 @@ BEGIN:
 
 	for (;u<ue;) {
 	  ufixnum v=(*u++)>>s;
-	  if (u<ue||m) {
+	  if (s&&(u<ue||m)) {
 	    ufixnum w=(*u);
 	    if (u==ue)
 	      w&=BIT_MASK(m);
-	    v|=w<<(sizeof(*u)-s);
+	    v|=w<<(BV_BITS-s);
 	  }
 	  h^=ufixhash(v);
 	}
--- gcl27-2.7.1.orig/o/main.c
+++ gcl27-2.7.1/o/main.c
@@ -380,6 +380,8 @@ get_gc_environ(void) {
   }
 
   multiprocess_memory_pool=getenv("GCL_MULTIPROCESS_MEMORY_POOL");
+  if (multiprocess_memory_pool && !*multiprocess_memory_pool)
+    multiprocess_memory_pool=NULL;
   if (multiprocess_memory_pool &&
       (*multiprocess_memory_pool=='t' || *multiprocess_memory_pool=='T'))/*GCL 2.6 compatability*/
     multiprocess_memory_pool=getenv("HOME");
@@ -705,9 +707,7 @@ DEFUN("KCL-SELF",object,fSkcl_self,SI,0,
 int
 main(int argc, char **argv, char **envp) {
 
-#ifdef DISABLE_ASLR
-  disable_aslr(argc,argv,envp);
-#endif
+  maybe_disable_aslr(argc,argv,envp);
 
 #include "cstack.h"
 
--- gcl27-2.7.1.orig/o/save.c
+++ gcl27-2.7.1/o/save.c
@@ -39,6 +39,7 @@ LFD(siLsave)(void) {
   set_global_env_defaults();
   shared_lib_start=NULL;
   memset(&fcall,0,sizeof(fcall));
+  memset(&ss,0,sizeof(ss));
   memset(gmp_jmp,0,sizeof(gmp_jmp));
   memset(stdin_buf,0,sizeof(stdin_buf));
   memset(stdout_buf,0,sizeof(stdout_buf));
--- gcl27-2.7.1.orig/o/unixfsys.c
+++ gcl27-2.7.1/o/unixfsys.c
@@ -173,8 +173,6 @@ fShome_namestring(object x) {
 FILE *
 fopen_not_dir(char *filename,char *option) {
 
-  struct stat ss;
-
   return DIR_EXISTS_P(filename,ss) ? NULL : fopen(filename,option);
 
 }
@@ -182,17 +180,13 @@ fopen_not_dir(char *filename,char *optio
 int
 file_len(FILE *fp) {/*FIXME dir*/
 
-  struct stat filestatus;
-
-  return fstat(fileno(fp), &filestatus) ? 0 : filestatus.st_size;
+  return fstat(fileno(fp), &ss) ? 0 : ss.st_size;
 
 }
 
 bool
 file_exists(object x) {
 
-  struct stat ss;
-
   coerce_to_filename(x,FN1);
 
   return FILE_EXISTS_P(FN1,ss) ? TRUE : FALSE;
@@ -232,8 +226,6 @@ stat_mode_key(struct stat *ssp) {
 
 DEFUN("STAT1",object,fSstat1,SI,1,1,NONE,OO,OO,OO,OO,(object x),"") {
 
-  struct stat ss;
-
   RETURN1(stat_internal(x,&ss) ? stat_mode_key(&ss) : Cnil);
 
 }
@@ -243,7 +235,6 @@ DEFUNM("STAT",object,fSstat,SI,1,1,NONE,
 
   object *vals=(object *)fcall.valp;
   object *base=vs_top;
-  struct stat ss;
 
   if (stat_internal(x,&ss))
     RETURN4(stat_mode_key(&ss),
@@ -372,8 +363,7 @@ DEFUN("READDIR",object,fSreaddir,SI,3,3,
 #define get_d_type(e,s) e->d_type
 #else
 #define get_d_type(e,s) \
-  ({struct stat ss;\
-    massert(snprintf(FN1,sizeof(FN1),"%-*.*s%s",s->st.st_fillp,s->st.st_fillp,s->st.st_self,e->d_name)>=0);\
+  ({massert(snprintf(FN1,sizeof(FN1),"%-*.*s%s",s->st.st_fillp,s->st.st_fillp,s->st.st_self,e->d_name)>=0);\
     lstat(FN1,&ss);S_ISDIR(ss.st_mode) ? DT_DIR : DT_REG;})
 #endif
 
@@ -517,7 +507,6 @@ get_mmap_flags(FILE *fp,void **ve,int fl
 
   int n;
   void *v1;
-  struct stat ss;
 
   massert((n=fileno(fp))>2);
   massert(!fstat(n,&ss));
--- gcl27-2.7.1.orig/unixport/sys.c
+++ gcl27-2.7.1/unixport/sys.c
@@ -23,8 +23,6 @@
 static void
 ar_init_fn(void (fn)(void),const char *s) {
 
-  struct stat ss;
-  
   if (stat(s,&ss)) {
 
     char *sysd=getenv("GCL_SYSDIR");
