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.7+dfsga-13) unstable; urgency=low
 .
   * ia64/hurd/s390 and SGC
Author: Camm Maguire <camm@debian.org>

---
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.7+dfsga.orig/h/object.h
+++ gcl-2.6.7+dfsga/h/object.h
@@ -163,7 +163,7 @@ struct fixnum_struct {
 #define mark(a_)                 if (is_imm_fixnum(Zcdr(a_))) mark_imm_fixnum(Zcdr(a_)); else (a_)->d.m=1
 #define unmark(a_)               if (is_imm_fixnum(Zcdr(a_))) unmark_imm_fixnum(Zcdr(a_)); else (a_)->d.m=0
 #define is_free(a_)              (!is_imm_fixnum(a_) && !is_imm_fixnum(Zcdr(a_)) && (a_)->d.f)
-#define make_free(a_)            {(a_)->fw=0;(a_)->d.f=1;}/*set_type_of(a_,t_other)*/
+#define make_free(a_)            ({(a_)->fw=0;(a_)->d.f=1;})/*set_type_of(a_,t_other)*/
 #define make_unfree(a_)          {(a_)->d.f=0;}
 
 #define valid_cdr(a_)            (!(a_)->d.e || is_imm_fixnum(Zcdr(a_)))
@@ -177,7 +177,7 @@ struct fixnum_struct {
 /* #define type_of(x)       ({register object _z=(object)(x);\ */
 /*       _z==Cnil ? t_symbol : is_imm_fixnum(_z) ? t_fixnum : _z->d.t;}) */
   
-#define set_type_of(x,y) ({object _x=(object)(x);enum type _y=(y);_x->fw=0;if (_y!=t_cons) {_x->d.e=1;_x->d.t=_y;}})
+#define set_type_of(x,y) ({object _x=(object)(x);enum type _y=(y);_x->d.f=0;if (_y!=t_cons) {_x->d.e=1;_x->d.t=_y;}})
 
 /* ({register object _z=(object)(x);			   \ */
 /*   _z==Cnil ? t_symbol :					   \ */
--- gcl-2.6.7+dfsga.orig/h/page.h
+++ gcl-2.6.7+dfsga/h/page.h
@@ -81,7 +81,7 @@ enum sgc_type { SGC_NORMAL,   /* not all
    have same length as a short
    (x->d.m || x->d.s) would be an equivalent for our purposes */
 /* struct sgc_firstword {short t; short sm;}; */
-#define SGC_OR_M(x)  (is_marked_or_free((object)x) || (valid_cdr((object)x) ? pageinfo(x)->sgc_flags&SGC_PAGE_FLAG : ((object)x)->d.s))
+#define SGC_OR_M(x)  (is_marked_or_free((object)x) || (pageinfo(x)->type==t_cons  ? pageinfo(x)->sgc_flags&SGC_PAGE_FLAG : ((object)x)->d.s))
 
 #ifndef SIGPROTV
 #define SIGPROTV SIGSEGV
--- gcl-2.6.7+dfsga.orig/o/alloc.c
+++ gcl-2.6.7+dfsga/o/alloc.c
@@ -318,11 +318,10 @@ add_page_to_freelist(char *p, struct typ
 
 #ifdef SGC
 
- if (sgc_enabled && tm->tm_sgc) {
-   if (!consp(x)) x->d.s=SGC_RECENT;
+ if (sgc_enabled && tm->tm_sgc)
    pp->sgc_flags=SGC_PAGE_FLAG;
- } else if (!consp(x))
-   x->d.s = SGC_NORMAL;
+ if (pp->type!=t_cons)
+   x->d.s=(sgc_enabled && tm->tm_sgc) ? SGC_RECENT : SGC_NORMAL;
 
  /* array headers must be always writable, since a write to the
     body does not touch the header.   It may be desirable if there
--- gcl-2.6.7+dfsga.orig/o/sgbc.c
+++ gcl-2.6.7+dfsga/o/sgbc.c
@@ -769,7 +769,7 @@ sgc_sweep_phase(void) {
 	  unmark(x);
 	  continue;
 	}
-	if(!valid_cdr(x) && x->d.s == SGC_NORMAL)
+	if (pageinfo(x)->type!=t_cons && x->d.s == SGC_NORMAL)
 	  continue;
 	
 	/* it is ok to free x */
@@ -802,7 +802,7 @@ sgc_sweep_phase(void) {
 	
 	SET_LINK(x,f);
 	make_free(x);
-	if (!valid_cdr(x)) x->d.s = SGC_RECENT;
+	if (pagetoinfo(i)!=t_cons) x->d.s = SGC_RECENT;
 	f = x;
 	k++;
       }
@@ -1365,12 +1365,12 @@ sgc_start(void) {
 #endif
 	if (pageinfo(f)->sgc_flags&SGC_PAGE_FLAG) {
 	  SET_LINK(f,x);
-	  if (!valid_cdr(f)) f->d.s = SGC_RECENT;
+	  if (pageinfo(f)->type!=t_cons) f->d.s = SGC_RECENT;
 	  x=f;
 	  count++;
 	} else {
 	  SET_LINK(f,y);
- 	  if (!valid_cdr(f)) f->d.s = SGC_NORMAL;
+ 	  if (pageinfo(f)->type!=t_cons) f->d.s = SGC_NORMAL;
 	  y=f;
 	}
 	f=next;
@@ -1578,7 +1578,7 @@ sgc_quit(void) {
   /*FIXME*/
   /* remove the recent flag from any objects on sgc pages */
   for (v=cell_list_head;v;v=v->next) 
-    if (v->type==(tm=tm_of(v->type))->tm_type && v->sgc_flags & SGC_PAGE_FLAG)
+    if (v->type==(tm=tm_of(v->type))->tm_type && v->type!=t_cons && v->sgc_flags & SGC_PAGE_FLAG)
       for (p=pagetochar(page(v)),j=tm->tm_nppage;j>0;--j,p+=tm->tm_size)
 	if (!valid_cdr((object)p)) ((object) p)->d.s=SGC_NORMAL;
   
