Add nbits = 0 case to copy_bits to compensate for division bug in gcc.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 20 Sep 1990 03:02:26 +0000 (03:02 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 20 Sep 1990 03:02:26 +0000 (03:02 +0000)
The bug arises when dividing by OBJECT_LENGTH inside
BIT_STRING_INDEX_TO_WORD.  The division is optimized into an unsigned
left shift that works for non-negative values, but not for -1, used
when the number of bits is 0!

v7/src/microcode/bitstr.c

index 39beb246453f61165e37a1e284cf89f501d8ec22..b4e115e9e67ea37e727318bb60228d42ec13bc67 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/bitstr.c,v 9.45 1990/09/08 00:09:43 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/bitstr.c,v 9.46 1990/09/20 03:02:26 jinx Rel $
 
 Copyright (c) 1987, 1988, 1989, 1990 Massachusetts Institute of Technology
 
@@ -394,6 +394,9 @@ copy_bits (source, source_offset, destination, destination_offset, nbits)
      transferred as SCHEME_OBJECTs, and only the `head' and `tail' need be
      treated specially. */
 
+  if (nbits == 0)
+    return;
+
   if (source_offset == destination_offset)
     {
       if (source_offset != 0)