rem: if (j < i) {
add: if (j < num_props) {
context: static Scheme_Object *_make_struct_type(Scheme_Object *basesym, const char *base, int blen,					Scheme_Object *parent,					Scheme_Object *inspector,					int num_fields,					int num_uninit_fields,					Scheme_Object *uninit_val,					Scheme_Object *props,					Scheme_Object *proc_attr,					Scheme_Object *immutable_pos_list,					Scheme_Object *guard){  Scheme_Struct_Type *struct_type, *parent_type;  int j, depth;    parent_type = (Scheme_Struct_Type *)parent;  depth = parent_type ? (1 + parent_type->name_pos) : 0;  struct_type =(Scheme_Struct_Type *)scheme_malloc_tagged(sizeof(Scheme_Struct_Type)							  + (depth 							     * sizeof(Scheme_Struct_Type *)));  /* defeats optimizer bug in gcc 2.7.2.3: */  depth = parent_type ? (1 + parent_type->name_pos) : 0;  struct_type->so.type = scheme_struct_type_type;  struct_type->name_pos = depth;  struct_type->parent_types[depth] = struct_type;  for (j = depth; j--; ) {    struct_type->parent_types[j] = parent_type->parent_types[j];  }  {    Scheme_Object *tn;    if (basesym)      tn = basesym;    else      tn = scheme_intern_exact_symbol(base, blen);    struct_type->name = tn;  }  struct_type->num_slots = num_fields + num_uninit_fields + (parent_type ? parent_type->num_slots : 0);  struct_type->num_islots = num_fields + (parent_type ? parent_type->num_islots : 0);  if (parent_type)    struct_type->proc_attr = parent_type->proc_attr;  /* Check for integer overflow or total more than 32768: */  if ((num_fields < 0) || (num_uninit_fields < 0)      || (num_fields > 32768)      || (num_uninit_fields > 32768)      || (num_uninit_fields + num_fields > 32768)      || (parent_type	  && ((struct_type->num_slots < parent_type->num_slots)	      || (struct_type->num_islots < parent_type->num_islots)))) {    /* Too many fields. */    scheme_raise_exn(MZEXN_FAIL,		     "too many fields for struct-type; maximum total field count is 32768");    return NULL;  }    if (!inspector) {    if (parent_type)      inspector = parent_type->inspector;    else {      inspector = scheme_get_param(scheme_current_config(), MZCONFIG_INSPECTOR);    }  }  struct_type->inspector = inspector;  if (parent_type) {    struct_type->num_props = parent_type->num_props;    struct_type->props = parent_type->props;  }  /* In principle, we should check for duplicate properties here   to keep the mismatch exceptions in the right order. */  if (!uninit_val)    uninit_val = scheme_false;  struct_type->uninit_val = uninit_val;  if (proc_attr) {    if (SCHEME_INTP(proc_attr) || SCHEME_BIGNUMP(proc_attr)) {      long pos;      if (SCHEME_INTP(proc_attr))	pos = SCHEME_INT_VAL(proc_attr);      else	pos = struct_type->num_slots; /* too big */      if (pos >= struct_type->num_islots) {	scheme_arg_mismatch("make-struct-type", "index for procedure >= initialized-field count: ", proc_attr);	return NULL;      }      if (parent_type) {	if (parent_type->proc_attr) {	  scheme_arg_mismatch("make-struct-type", 			      "parent type already has procedure specification, new one disallowed: ",			      proc_attr);	  return NULL;	}	pos += parent_type->num_slots;	proc_attr = scheme_make_integer(pos);      }    }    struct_type->proc_attr = proc_attr;  }  if ((struct_type->proc_attr && SCHEME_INTP(struct_type->proc_attr))      || !SCHEME_NULLP(immutable_pos_list)) {    Scheme_Object *l, *a;    char *ims;    int n, p;    n = struct_type->num_slots;    if (parent_type)      n -= parent_type->num_slots;    ims = (char *)scheme_malloc_atomic(n);    memset(ims, 0, n);    if (SCHEME_INTP(struct_type->proc_attr)) {      p = SCHEME_INT_VAL(struct_type->proc_attr);      if (parent_type)	p -= parent_type->num_slots;      if (p >= 0)	ims[p] = 1;    }    for (l = immutable_pos_list; SCHEME_PAIRP(l); l = SCHEME_CDR(l)) {      a = SCHEME_CAR(l);      if (SCHEME_INTP(a))	p = SCHEME_INT_VAL(a);      else	p = struct_type->num_slots; /* too big */      if (p >= struct_type->num_islots) {	scheme_raise_exn(MZEXN_FAIL_CONTRACT,			 "make-struct-type: index %V for immutable field >= initialized-field count %d in list: %V", 			 a, struct_type->num_islots, immutable_pos_list);	return NULL;      }      if (ims[p]) {	scheme_raise_exn(MZEXN_FAIL_CONTRACT,			 "make-struct-type: redundant immutable field index %V in list: %V", 			 a, immutable_pos_list);	return NULL;      }      ims[p] = 1;    }        struct_type->immutables = ims;  }  /* We add properties last, because a property guard receives a     struct-type descriptor. */  if (props) {    int num_props, i;    Scheme_Hash_Table *can_override;    Scheme_Object *l, *a, *prop, *propv;    can_override = scheme_make_hash_table(SCHEME_hash_ptr);    num_props = scheme_list_length(props);    if ((struct_type->num_props < 0) || (struct_type->num_props + num_props > PROP_USE_HT_COUNT)) {      Scheme_Hash_Table *ht;      ht = scheme_make_hash_table(SCHEME_hash_ptr);          if (struct_type->num_props >= 0) {	for (i = 0; i < struct_type->num_props; i++) {	  prop = SCHEME_CAR(struct_type->props[i]);	  scheme_hash_set(ht, prop, SCHEME_CDR(struct_type->props[i]));	  scheme_hash_set(can_override, prop, scheme_true);	}      } else {	/* Duplicate the hash table: */	Scheme_Hash_Table *oht = (Scheme_Hash_Table *)struct_type->props;	for (i =  oht->count; i--; ) {	  if (oht->vals[i]) {	    prop = oht->keys[i];	    scheme_hash_set(ht, prop, oht->vals[i]);	    scheme_hash_set(can_override, prop, scheme_true);	  }	}      }      /* Add new props: */      for (l = props; SCHEME_PAIRP(l); l = SCHEME_CDR(l)) {	a = SCHEME_CAR(l);	prop = SCHEME_CAR(a);	if (scheme_hash_get(ht, prop)) {	  /* Property is already in the superstruct_type */	  if (!scheme_hash_get(can_override, prop))	    break;	  /* otherwise we override */	  scheme_hash_set(can_override, prop, NULL);	}		propv = guard_property(prop, SCHEME_CDR(a), struct_type);		scheme_hash_set(ht, prop, propv);      }      struct_type->props = (Scheme_Object **)ht;      struct_type->num_props = -1;    } else {      /* Make props array: */      Scheme_Object **pa;      int j;            /* Remember origs, so we can override */      for (i = 0; i < struct_type->num_props; i++) {	prop = SCHEME_CAR(struct_type->props[i]);	scheme_hash_set(can_override, prop, scheme_true);      }            pa = MALLOC_N(Scheme_Object *, i + num_props);      memcpy(pa, struct_type->props, sizeof(Scheme_Object *) * i);      num_props = i;      for (l = props; SCHEME_PAIRP(l); l = SCHEME_CDR(l)) {	a = SCHEME_CAR(l);	prop = SCHEME_CAR(a);	/* Check whether already in table: */	for (j = 0; j < num_props; j++) {	  if (SAME_OBJ(SCHEME_CAR(pa[j]), prop))	    break;	}	if (j < i) {	  /* already there */	  if (!scheme_hash_get(can_override, prop))	    break; 	  /* overriding it: */	  scheme_hash_set(can_override, prop, NULL);	} else {	  num_props++;	}	propv = guard_property(prop, SCHEME_CDR(a), struct_type);	a = scheme_make_pair(prop, propv);	pa[j] = a;      }            struct_type->num_props = num_props;      struct_type->props = pa;    }    if (!SCHEME_NULLP(l)) {      /* SCHEME_CAR(l) is a duplicate */      a = SCHEME_CAR(l);      scheme_arg_mismatch("make-struct-type", "duplicate property binding: ", a);    }  }  if (guard) {        if (!scheme_check_proc_arity(NULL, struct_type->num_islots + 1, -1, 0, &guard)) {      scheme_raise_exn(MZEXN_FAIL_CONTRACT,		       "make-struct-type: guard procedure does not accept %d arguments "		       "(one more than the number constructor arguments): %V",		       struct_type->num_islots + 1, guard);    }        struct_type->guard = guard;  }        return (Scheme_Object *)struct_type;}