Description: <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.
 .
 gcl (2.6.10-2) unstable; urgency=high
 .
   * 2.6.11pre test 1
   * Bug fix: "FTBFS: gcl_readline.d:472:39: error: &#39;CPPFunction&#39;
     undeclared (first use in this function)", thanks to David Suárez
     (Closes: #741819).
Author: Camm Maguire <camm@debian.org>
Bug-Debian: http://bugs.debian.org/741819

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

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.10.orig/cmpnew/gcl_cmpeval.lsp
+++ gcl-2.6.10/cmpnew/gcl_cmpeval.lsp
@@ -613,8 +613,8 @@
     ;; We can't read in long-floats which are too big:
     (let* (sc (vv (cond ((> (abs val) (/ most-positive-long-float 2))
 			 (add-object `(si::|#,| * ,(/ val most-positive-long-float) most-positive-long-float)))
-			((< (abs val) (* least-positive-long-float 1.0d20))
-			 (add-object `(si::|#,| * ,(/ val least-positive-long-float) least-positive-long-float)))
+			((< (abs val) (* least-positive-normalized-long-float 2.0))
+			 (add-object `(si::|#,| * ,(/ val least-positive-normalized-long-float) least-positive-normalized-long-float)))
 			((setq sc t) (add-object val)))))
       `(location ,(make-info :type 'long-float)
 		 ,(if sc (list 'LONG-FLOAT-VALUE vv val) (list 'vv vv)))))
--- gcl-2.6.10.orig/configure
+++ gcl-2.6.10/configure
@@ -4346,6 +4346,7 @@ case $use in
 #			TCFLAGS="$TCFLAGS -ffloat-store";;
 		hppa*)
 			TCFLAGS="$TCFLAGS -mlong-calls "
+			TLIBS="$TLIBS -lgcc_s" # workaround hppa __moddi3 local func symbols with default linker flags
 #			TCFLAGS="$TCFLAGS -ffunction-sections"
 #			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O $TFPFLAG" ; fi
 #			if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
@@ -5025,7 +5026,7 @@ else
 /* end confdefs.h.  */
 #include <gmp.h>
 				    int main() {
-				    #if __GNU_MP_VERSION == 4 || __GNU_MP_VERSION == 5
+				    #if __GNU_MP_VERSION > 3
 					return 0;
 				    #else
 					return -1;
--- gcl-2.6.10.orig/configure.in
+++ gcl-2.6.10/configure.in
@@ -594,6 +594,7 @@ case $use in
 #			TCFLAGS="$TCFLAGS -ffloat-store";;
 		hppa*)
 			TCFLAGS="$TCFLAGS -mlong-calls "
+			TLIBS="$TLIBS -lgcc_s" # workaround hppa __moddi3 local func symbols with default linker flags
 #			TCFLAGS="$TCFLAGS -ffunction-sections"
 #			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O $TFPFLAG" ; fi
 #			if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
@@ -767,7 +768,7 @@ if test $use_gmp = yes ; then
 			AC_MSG_CHECKING("for external gmp version")
 			AC_TRY_RUN([#include <gmp.h>
 				    int main() {
-				    #if __GNU_MP_VERSION == 4 || __GNU_MP_VERSION == 5
+				    #if __GNU_MP_VERSION > 3
 					return 0;
 				    #else
 					return -1;
--- gcl-2.6.10.orig/h/gmp_wrappers.h
+++ gcl-2.6.10/h/gmp_wrappers.h
@@ -146,6 +146,7 @@ MEM_GMP_CALL(2,void,mpz_set_si,1,mpz_t,l
 MEM_GMP_CALL(1,double,mpz_get_d,0,mpz_t)
 MEM_GMP_CALL(1,gmp_lint,mpz_get_si,0,mpz_t)
 MEM_GMP_CALL(3,gmp_char_star,mpz_get_str,0,char *,int,mpz_t)
+MEM_GMP_CALL(3,int,mpz_set_str,0,mpz_t,char *,int)/*arg set, but 0 for check as moot*/
 MEM_GMP_CALL(1,int,mpz_fits_sint_p,0,mpz_t)
 MEM_GMP_CALL(1,gmp_ulint,mpz_popcount,0,mpz_t)
 /*MEM_GMP_CALL(2,void *,mpz_realloc,mpz_t,mp_size_t)*/
@@ -188,6 +189,7 @@ MEM_GMP_CALL(2,size_t,mpz_sizeinbase,0,m
 #define __gmpz_get_d m__gmpz_get_d
 #define __gmpz_get_si m__gmpz_get_si
 #define __gmpz_get_str m__gmpz_get_str
+#define __gmpz_set_str m__gmpz_set_str
 #define __gmpz_fits_sint_p m__gmpz_fits_sint_p
 #define __gmpz_popcount m__gmpz_popcount
 /*#define __gmpz_realloc m__gmpz_realloc*/
--- gcl-2.6.10.orig/o/file.d
+++ gcl-2.6.10/o/file.d
@@ -307,37 +307,38 @@ BEGIN:
 	}
 }
 
-#ifndef NO_SETBUF
 void
 setup_stream_buffer(object x) {
+#ifndef NO_SETBUF
   char *buf=alloc_contblock(BUFSIZ);
   x->sm.sm_buffer = buf;
   setbuf(x->sm.sm_fp, buf);
+#else
+  setvbuf(x->sm.sm_fp,NULL,_IONBF,0);
+  x->sm.sm_buffer=0;
+#endif
 }	
 
 static void
-deallocate_stream_buffer(strm)
-object strm;
-{
+deallocate_stream_buffer(object strm) {
 
 /* SGC contblock pages: Its possible this is on an old page CM 20030827 */
-  if (strm->sm.sm_buffer) 
-    {
+  if (strm->sm.sm_buffer) {
 #ifdef SGC
-      insert_maybe_sgc_contblock(strm->sm.sm_buffer, BUFSIZ); 
+    insert_maybe_sgc_contblock(strm->sm.sm_buffer, BUFSIZ); 
 #else
-      insert_contblock(strm->sm.sm_buffer, BUFSIZ); 
+    insert_contblock(strm->sm.sm_buffer, BUFSIZ); 
 #endif
-    strm->sm.sm_buffer = 0;} 
-  else 
-    printf("no buffer? %p  \n",strm->sm.sm_fp); 
+    if (strm->sm.sm_fp)
+      setvbuf(strm->sm.sm_fp,NULL,_IONBF,0);
+    strm->sm.sm_buffer = 0;
+  } 
 
 #ifndef FCLOSE_SETBUF_OK
   strm->sm.sm_fp->_base = NULL;
 #endif
+
 }
-/* end ifndef NO_SETBUF */
-#endif
 
 DEFVAR("*ALLOW-GZIPPED-FILE*",sSAallow_gzipped_fileA,SI,sLnil,"");
 
--- gcl-2.6.10.orig/o/read.d
+++ gcl-2.6.10/o/read.d
@@ -28,6 +28,7 @@ Foundation, 675 Mass Ave, Cambridge, MA
 
 #include <string.h>
 #include <errno.h>
+#include "num_include.h"
 
 static object
 current_readtable(void);
@@ -36,8 +37,146 @@ DEFVAR("PATCH-SHARP",sSpatch_sharp,SI,sL
 static object
 patch_sharp(object x) {return ifuncall1(sSpatch_sharp,x);}
 
-static object
-parse_number(char *,int,int *,int);
+
+#define digitp digitp1
+
+static inline int
+digitp(int i,int r) {
+  
+  if ( r<=10 || i<='9' )
+    i-='0';
+  else {
+    i=tolower(i)-'a';
+    i=i<0 ? i : i+10;
+  }
+
+  return i<r ? i : -1;
+
+}
+
+static inline object
+parse_unsigned_integer_negate(char *s1,char **ep,int radix,int neg) {
+
+  fixnum f,o,u,l=MOST_POSITIVE_FIX/radix-1;
+  int r,d;
+  char ch,*s;
+
+  if (radix==10)
+    for (o=u=1,f=0,s=s1;*s && *s<='9' && (d=*s-'0')>=0;u=0,o=o && f<l,f=f*10+d,s++);
+  else
+    for (o=u=1,f=0,s=s1;*s && (d=digitp(*s,radix))>=0;u=0,o=o && f<l,f=f*radix+d,s++);
+
+  *ep=s;
+
+  if (u) return OBJNULL;
+  if (o && !*s) return make_fixnum(neg ? -f : f);
+
+  ch=*s;
+  *s=0;
+  r=mpz_set_str(MP(big_fixnum1),s1,radix);
+  *s=ch;
+
+  if (r) return OBJNULL;
+
+  if (neg) set_big_sign(big_fixnum1,-1);
+
+  return normalize_big_to_object(big_fixnum1);
+
+}
+
+static inline object
+parse_unsigned_integer(char *s,char **ep,int radix) {
+
+  return parse_unsigned_integer_negate(s,ep,radix,0);
+
+}
+
+
+static inline object
+parse_integer(char *s,char **ep,int radix) {
+
+  int negate=0;
+
+  switch (*s) {
+  case '-':
+    negate=1;
+  case '+':
+    s++;
+  default:
+    break;
+  }
+
+  return parse_unsigned_integer_negate(s,ep,radix,negate);
+
+}
+
+
+static inline object
+parse_number(char *s,int radix) {
+
+  object x,y;
+  char *q,ch,c;
+  int n,m;
+  double f;
+
+  x=parse_integer(s,&q,radix);
+
+  switch (*q) {
+  case 0:
+    return x;
+  case '/':
+    y=parse_unsigned_integer(q+1,&q,radix);
+    return (x==OBJNULL || y==OBJNULL || *q) ? OBJNULL : make_ratio(x,y);
+  default:
+    if (radix!=10)
+      x=parse_integer(s,&q,10);
+
+    if ((ch=*q)=='.') {
+      if (!*++q) return x;
+      parse_unsigned_integer(q,&q,10);
+      ch=*q ? *q : 'E';
+    }
+
+    if ((c=*q)) *q='E';
+    n=sscanf(s,"%lf%n",&f,&m);
+    *q=c;
+    if (n!=1||s[m]) return OBJNULL;
+
+    switch (ch=='e' || ch=='E' ? READdefault_float_format : ch) {
+    case 's':case 'S':
+      return make_shortfloat((float)f);
+    case 'f':case 'F':case 'd':case 'D':case 'l':case 'L':
+      return make_longfloat(f);
+    default:
+      return OBJNULL;
+    }
+  }
+}
+
+static inline void
+too_long_token(void) {
+  char *q;
+  int i;
+  
+  BEGIN_NO_INTERRUPT;
+  q = alloc_contblock(token->st.st_dim*2);
+  for (i = 0;  i < token->st.st_dim;  i++)
+    q[i] = token->st.st_self[i];
+  token->st.st_self = q;
+  token->st.st_dim *= 2;
+  END_NO_INTERRUPT;
+
+}
+
+static inline void
+null_terminate_token(void) {
+
+  if (token->st.st_fillp==token->st.st_dim)
+    too_long_token();
+  token->st.st_self[token->st.st_fillp]=0;
+
+}
+
 
 #define	token_buffer	token->st.st_self
 /* the active length of the token */
@@ -408,8 +547,6 @@ L:
    } while(0)
 #endif
 
-static void
-too_long_token(void);
 /*
 	Read_object(in) reads an object from stream in.
 	This routine corresponds to COMMON Lisp function READ.
@@ -586,8 +723,9 @@ N:
 	token->st.st_fillp = length;
 	if (escape_flag || (READbase<=10 && token_buffer[0]>'9'))
 	  goto SYMBOL;
-	x = parse_number(token_buffer, length, &i, READbase);
-	if (x != OBJNULL && length == i) {
+	null_terminate_token();
+	x = parse_number(token_buffer, READbase);
+	if (x != OBJNULL) {
 		vs_reset;
 		return(x);
 	}
@@ -700,359 +838,6 @@ ENDUP:
 	return;
 }
 
-#define	is_exponent_marker(i)	\
-	((i) == 'e' || (i) == 'E' ||	\
-	 (i) == 's' || (i) == 'S' || (i) == 'f' || (i) == 'F' || \
-	 (i) == 'd' || (i) == 'D' || (i) == 'l' || (i) == 'L' || \
-	 (i) == 'b' || (i) == 'B')
-
-double pow();
-
-static double
-new_fraction(char *s,int end,int exp_pos,int *err) {
-
-  char ch,ch1=0,*p;
-  double fraction;
-
-  ch=s[end];
-  s[end]=0;
-  if (exp_pos>=0) {ch1=s[exp_pos];s[exp_pos]='E';}
-/*  sscanf(s,"%lf",&fraction);*/
-  errno=0;
-  fraction=strtod(s,&p);
-  *err=errno || *p;
-  s[end]=ch;
-  if (exp_pos>=0) s[exp_pos]=ch1;
-
-  return fraction;
-
-}
-
-
-/*
-	Parse_number(s, end, ep, radix) parses C string s
-	up to (but not including) s[end]
-	using radix as the radix for the rational number.
-	(For floating numbers, radix should be 10.)
-	When parsing has been succeeded,
-	the index of the next character is assigned to *ep,
-	and the number is returned as a lisp data object.
-	If not, OBJNULL is returned.
-*/
-static object
-parse_number(char *s, int end, int *ep, int radix) {
-
-  object x=Cnil;
-  fixnum sign;
-  object integer_part;
-  double fraction, fraction_unit, f;
-  char exponent_marker;
-  int exponent,exp_pos=-1;
-  int i, j, k;
-  int d;
-  vs_mark;
-  
- BEGIN:
-  exponent_marker = 'E';
-  i = 0;
-  sign = 1;
-  if (s[i] == '+')
-    i++;
-  else if (s[i] == '-') {
-    sign = -1;
-    i++;
-  }
-  integer_part = (object)  big_register_0;
-  zero_big(big_register_0);
-  vs_push((object)integer_part);
-  if (i >= end)
-    goto NO_NUMBER;
-
-  j=i;
-
-#define MOST_POSITIVE_FIX (((unsigned long) (~0) ) /2)
-/*FIXME 64!!!*/
-#define TEN_EXPT_9 1000000000
-  
-  if (radix == 10 && TEN_EXPT_9 <MOST_POSITIVE_FIX ) {
-    
-    int chunk = 0;
-    int sum = 0;
-    
-    while (i < end && (d = digitp(s[i], radix)) >= 0) {    
-      sum = 10*sum+d;
-      chunk++;
-      if (chunk == 9) {
-	mul_int_big(1000000000, integer_part);
-	add_int_big(sum, integer_part);
-	chunk=0; sum=0;
-      } 
-      i++;
-    }
-    
-    if (chunk) {
-      
-      int fac=10;
-      
-      while(--chunk> 0) 
-	fac *=10;
-      
-      mul_int_big(fac,integer_part);
-      add_int_big(sum,integer_part);
-      
-    }
-    
-  } else 
-    
-    while (i < end && (d = digitp(s[i], radix)) >= 0) {
-      mul_int_big(radix, integer_part);
-      add_int_big(d, integer_part);
-      i++;
-    }
-  
-  if (i >= end)
-    goto MAKE_INTEGER;
-  if (s[i] == '/') {
-    if (i==j || ++i >= end || (d = digitp(s[i], radix)) < 0)
-      goto NO_NUMBER;
-    goto DENOMINATOR;
-  }
-
-  if (radix!=10) 
-    for (j=i;j<end;j++)
-      if (s[j]=='.'|| is_exponent_marker(s[j])) {
-	radix=10;
-	goto BEGIN;
-      }
-  
-  if (s[i] == '.') {
-    if (++i >= end)
-      goto MAKE_INTEGER;
-    else if ((d=digitp(s[i], radix)) >= 0)
-      goto FRACTION;
-    else if (is_exponent_marker(s[i])) {
-      fraction
-	= (double)sign * big_to_double(integer_part);
-      goto EXPONENT;
-    } else
-      goto MAKE_INTEGER;
-  }
-  if (is_exponent_marker(s[i])) {
-    fraction = (double)sign * big_to_double(integer_part);
-    goto EXPONENT;
-  }
-  
-  /*
-    goto NO_NUMBER;
-  */
-  
- MAKE_INTEGER:
-  if (sign < 0 && signe(MP(integer_part)))
-    set_big_sign(integer_part,-1);
-  x = normalize_big_to_object(integer_part);
-  if (x == big_register_0)
-    big_register_0 = alloc_object(t_bignum);
-  zero_big(big_register_0);
-  
-  goto END;
-  
- FRACTION:
-  if (radix!=10)
-    FEerror("Parse_number radix error", 0);
-/*   if ((d = digitp(s[i], radix)) < 0) */
-/*     goto NO_NUMBER; */
-  fraction = 0.0;
-  fraction_unit = 1000000000.0;
-  for (;;) {
-    k = j = 0;
-    do {
-      j = 10*j + d;
-      i++;
-      k++;
-      if (i < end)
-	d = digitp(s[i], radix);
-      else
-	break;
-    } while (k < 9 && d >= 0);
-    while (k++ < 9)
-      j *= 10;
-    fraction += ((double)j /fraction_unit);
-    if (i >= end || d < 0)
-      break;
-    fraction_unit *= 1000000000.0;
-  }
-  fraction += big_to_double(integer_part);
-  fraction *= (double)sign;
-  if (i >= end)
-    goto MAKE_FLOAT;
-  if (is_exponent_marker(s[i]))
-    goto EXPONENT;
-  goto MAKE_FLOAT;
-  
- EXPONENT:
-  if (radix!=10)
-    FEerror("Parse_number radix error", 0);
-  exponent_marker = s[i];
-  exp_pos=i;
-  i++;
-  if (i >= end)
-    goto NO_NUMBER;
-  sign = 1;
-  if (s[i] == '+')
-    i++;
-  else if (s[i] == '-') {
-    sign = -1;
-    i++;
-  }
-  if (i >= end)
-    goto NO_NUMBER;
-  if ((d = digitp(s[i], radix)) < 0)
-    goto NO_NUMBER;
-  exponent = 0;
-  do {
-    exponent = 10 * exponent + d;
-    i++;
-  } while (i < end && (d = digitp(s[i], radix)) >= 0);
-  d = exponent;
-  f = 10.0;
-  /* Use pow because it is more accurate */
-  { double po = pow(10.0,(double)(sign * d));
-  if (po == 0.0)
-    { fraction = fraction *pow(10.0,(double)(sign * (d-1)));
-    fraction /= 10.0;}  
-  else     
-    fraction = fraction * po;}
-  
- MAKE_FLOAT:
-#ifdef IEEEFLOAT
-  if (!ISFINITE(fraction))
-    FEerror("Floating-point overflow.", 0);
-#endif
-  switch (exponent_marker) {
-    
-  case 'e':  case 'E':
-    exponent_marker = READdefault_float_format;
-    goto MAKE_FLOAT;
-    
-  case 's':  case 'S':
-    {
-      int err;
-      /*FIXME code above cannot re-read denormalized numbers accurately*/
-      x = make_shortfloat((shortfloat)new_fraction(s,end,exp_pos,&err));
-      if (err) goto NO_NUMBER;
-    }
-    break;
-    
-  case 'f':  case 'F':  case 'd':  case 'D':  case 'l':  case 'L':
-    {
-      int err;
-      x = make_longfloat((longfloat)new_fraction(s,end,exp_pos,&err));
-      if (err) goto NO_NUMBER;
-    }
-    break;
-    
-  case 'b':  case 'B':
-    goto NO_NUMBER;
-  }
-
-  zero_big(big_register_0);
-  
-  goto END;
-  
- DENOMINATOR:
-  if (sign < 0)
-    set_big_sign(integer_part,-1);
-  vs_push(normalize_big_to_object(integer_part));
-
-  if (vs_head == big_register_0)
-    big_register_0 = new_bignum();
-  zero_big(big_register_0);
-  
-/*   if ((d = digitp(s[i], radix)) < 0) */
-/*     goto NO_NUMBER; */
-  integer_part = big_register_0;
-  /*	zero_big(integer_part); */
-  do {
-    mul_int_big(radix, integer_part);
-    add_int_big(d, integer_part);
-    i++;
-  } while (i < end && (d = digitp(s[i], radix)) >= 0);
-  vs_push(normalize_big_to_object(integer_part));
-  x = make_ratio(vs_top[-2], vs_top[-1]);
-  goto END;
-  
- END:
-  *ep = i;
-  vs_reset;
-  return(x);
-  
- NO_NUMBER:
-  *ep = i;
-  vs_reset;
-  zero_big(big_register_0);
-  
-  return(OBJNULL);
-
-}
-
-static object
-parse_integer(s, end, ep, radix)
-char *s;
-int end, *ep, radix;
-{
-	object x;
-	fixnum sign;
-	object integer_part;
-	int i, d;
-	vs_mark;
-
-	i = 0;
-	sign = 1;
-	if (s[i] == '+')
-		i++;
-	else if (s[i] == '-') {
-		sign = -1;
-		i++;
-	}
-	integer_part = big_register_0;
-	vs_push((object)integer_part);
-	if (i >= end)
-		goto NO_NUMBER;
-	if ((d = digitp(s[i], radix)) < 0)
-		goto NO_NUMBER;
-        
-	do {
-		mul_int_big(radix, integer_part);
-		add_int_big(d, integer_part);
-		i++;
-	} while (i < end && (d = digitp(s[i], radix)) >= 0);
-
-
-	if (sign < 0)
-		set_big_sign(integer_part,-1);
-	x = normalize_big_to_object(integer_part);
-/**/
-	if (x == big_register_0)
-		big_register_0 = alloc_object(t_bignum);
-	zero_big(big_register_0);
-	
-/**/
-	*ep = i;
-	vs_reset;
-	return(x);
-
-NO_NUMBER:
-	*ep = i;
-	vs_reset;
-/**/
-	zero_big(big_register_0);
-/**/
-	return(OBJNULL);
-}
-
-
-static void
-too_long_string(void);
 
 /*
 	Read_string(delim, in) reads
@@ -1076,7 +861,7 @@ object in;
 		else if (cat(c) == cat_single_escape)
 			c = read_char(in);
 		if (i >= token->st.st_dim)
-			too_long_string();
+			too_long_token();
 		token_buffer[i++] = char_code(c);
 	}
 	token->st.st_fillp = i;
@@ -1145,8 +930,9 @@ Ldispatch_reader()
 	  FEerror("Dispatch number too long", 0);
 	if (i) {
 	  token->st.st_fillp=i;
-	  x=parse_number(token->st.st_self,token->st.st_fillp, &i, 10);
-	  if (x == OBJNULL || i != token->st.st_fillp)
+	  null_terminate_token();
+	  x=parse_number(token->st.st_self,10);
+	  if (x == OBJNULL)
 	    FEerror("Cannot parse the dispatch macro number.", 0);
 	} else
 	  x=Cnil;
@@ -1621,7 +1407,6 @@ Lsharp_exclamation_reader()
 static void
 Lsharp_B_reader()
 {
-	int i;
 
 	if(vs_base[2] != Cnil && !READsuppress)
 		extra_argument('B');
@@ -1632,9 +1417,10 @@ Lsharp_B_reader()
 		vs_base[0] = Cnil;
 		return;
 	}
+	null_terminate_token();
 	vs_base[0]
-	= parse_number(token_buffer, token->st.st_fillp, &i, 2);
-	if (vs_base[0] == OBJNULL || i != token->st.st_fillp)
+	= parse_number(token_buffer, 2);
+	if (vs_base[0] == OBJNULL)
 		FEerror("Cannot parse the #B readmacro.", 0);
 	if (type_of(vs_base[0]) == t_shortfloat ||
 	    type_of(vs_base[0]) == t_longfloat)
@@ -1645,7 +1431,6 @@ Lsharp_B_reader()
 static void
 Lsharp_O_reader()
 {
-	int i;
 
 	if(vs_base[2] != Cnil && !READsuppress)
 		extra_argument('O');
@@ -1656,9 +1441,10 @@ Lsharp_O_reader()
 		vs_base[0] = Cnil;
 		return;
 	}
+	null_terminate_token();
 	vs_base[0]
-	= parse_number(token_buffer, token->st.st_fillp, &i, 8);
-	if (vs_base[0] == OBJNULL || i != token->st.st_fillp)
+	= parse_number(token_buffer, 8);
+	if (vs_base[0] == OBJNULL)
 		FEerror("Cannot parse the #O readmacro.", 0);
 	if (type_of(vs_base[0]) == t_shortfloat ||
 	    type_of(vs_base[0]) == t_longfloat)
@@ -1669,7 +1455,6 @@ Lsharp_O_reader()
 static void
 Lsharp_X_reader()
 {
-	int i;
 
 	if(vs_base[2] != Cnil && !READsuppress)
 		extra_argument('X');
@@ -1680,9 +1465,10 @@ Lsharp_X_reader()
 		vs_base[0] = Cnil;
 		return;
 	}
+	null_terminate_token();
 	vs_base[0]
-	= parse_number(token_buffer, token->st.st_fillp, &i, 16);
-	if (vs_base[0] == OBJNULL || i != token->st.st_fillp)
+	= parse_number(token_buffer, 16);
+	if (vs_base[0] == OBJNULL)
 		FEerror("Cannot parse the #X readmacro.", 0);
 	if (type_of(vs_base[0]) == t_shortfloat ||
 	    type_of(vs_base[0]) == t_longfloat)
@@ -1693,7 +1479,7 @@ Lsharp_X_reader()
 static void
 Lsharp_R_reader()
 {
-	int radix=0, i;
+	int radix=0;
 
 	check_arg(3);
 	if (READsuppress)
@@ -1711,9 +1497,10 @@ Lsharp_R_reader()
 		vs_base[0] = Cnil;
 		return;
 	}
+	null_terminate_token();
 	vs_base[0]
-	= parse_number(token_buffer, token->st.st_fillp, &i, radix);
-	if (vs_base[0] == OBJNULL || i != token->st.st_fillp)
+	= parse_number(token_buffer, radix);
+	if (vs_base[0] == OBJNULL)
 		FEerror("Cannot parse the #R readmacro.", 0);
 	if (type_of(vs_base[0]) == t_shortfloat ||
 	    type_of(vs_base[0]) == t_longfloat)
@@ -2036,8 +1823,8 @@ READ:
 			c = Cnil;
 			break;
 		}
-		if (i >= token->st.st_dim)
-			too_long_string();
+		if (i >= token->st.st_dim-1)
+			too_long_token();
 		token->st.st_self[i++] = char_code(c);
 	}
  FINISH:
@@ -2208,11 +1995,16 @@ READ:
 		else
 			goto CANNOT_PARSE;
 	}
-        {char *tmp = OUR_ALLOCA(e-s);
-         bcopy( strng->st.st_self+s,tmp,e-s);
-	  x = parse_integer(tmp, e-s, &ep, fix(radix));
-         ALLOCA_FREE(tmp);
-         }
+        {
+	  char *q;
+	  while (token->st.st_dim<e-s)
+	    too_long_token();
+	  memcpy(token->st.st_self,strng->st.st_self+s,e-s);
+	  token->st.st_fillp=e-s;
+	  null_terminate_token();
+	  x = parse_integer(token->st.st_self, &q, fix(radix));
+	  ep=q-token->st.st_self;
+	}
 	if (x == OBJNULL) {
 		if (junk_allowed != Cnil)
 			@(return Cnil `make_fixnum(ep+s)`)
@@ -2459,43 +2251,6 @@ FFN(siLstandard_readtable)()
 }
 
 static void
-too_long_token(void)
-{
-	char *q;
-	int i;
-
-	{BEGIN_NO_INTERRUPT;
-	q = alloc_contblock(token->st.st_dim*2);
-	for (i = 0;  i < token->st.st_dim;  i++)
-		q[i] = token->st.st_self[i];
-	token->st.st_self = q;
-	token->st.st_dim *= 2;
-	END_NO_INTERRUPT;}
-/*
-	token->st.st_fillp = token->st.st_dim;
-	FEerror("Too long a token: ~A.", 1, token);
-*/
-}
-
-static void
-too_long_string(void)
-{
-	char *q;
-	int i;
-	{BEGIN_NO_INTERRUPT;
-	q = alloc_contblock(token->st.st_dim*2);
-	for (i = 0;  i < token->st.st_dim;  i++)
-		q[i] = token->st.st_self[i];
-	token->st.st_self = q;
-	token->st.st_dim *= 2;
-	END_NO_INTERRUPT;}
-/*
-	token->st.st_fillp = token->st.st_dim;
-	FEerror("Too long a string: ~S.", 1, token);
-*/
-}
-
-static void
 extra_argument(c)
 int c;
 {
@@ -2647,16 +2402,6 @@ gcl_init_read()
 	in_list_flag = FALSE;
 	dot_flag = FALSE;
 
-	big_register_0 = new_bignum();
-	zero_big(big_register_0);
- 
-	enter_mark_origin(&big_register_0);
-/*
-	NOTE:
-
-		The value of big_register_0 changes
-		along the execution of the read routines.
-*/
 }
 
 void
--- gcl-2.6.10.orig/o/sgbc.c
+++ gcl-2.6.10/o/sgbc.c
@@ -1305,19 +1305,21 @@ sgc_start(void) {
     writable_pages=0;
 
     for (pi=cell_list_head;pi;pi=pi->next) {
-      void *v,*ve;
       if (pi->sgc_flags&SGC_WRITABLE)
 	SET_WRITABLE(page(pi));
       else
 	tm_of(pi->type)->tm_alt_npage++;
 #ifndef NO_SETBUF /*FIXME, implement restartable getc with read in readc_stream*/
-      if (pi->type!=(tm=tm_of(t_stream))->tm_type) continue;
-      for (v=pagetochar(page(pi)),ve=v+tm->tm_nppage*tm->tm_size;v<ve;v+=tm->tm_size) {
-	object x=v;
-	if (type_of(x)!=t_stream || is_free(x)) continue;
-	if (x->sm.sm_buffer) 
-	  for (i=page(x->sm.sm_buffer);i<=page(x->sm.sm_buffer+BUFSIZ-1);i++)
-	    SET_WRITABLE(i);
+      {
+	void *v,*ve;
+	if (pi->type!=(tm=tm_of(t_stream))->tm_type) continue;
+	for (v=pagetochar(page(pi)),ve=v+tm->tm_nppage*tm->tm_size;v<ve;v+=tm->tm_size) {
+	  object x=v;
+	  if (type_of(x)!=t_stream || is_free(x)) continue;
+	  if (x->sm.sm_buffer) 
+	    for (i=page(x->sm.sm_buffer);i<=page(x->sm.sm_buffer+BUFSIZ-1);i++)
+	      SET_WRITABLE(i);
+	}
       }
 #endif
     }
