From d337a1c8b940dfcd1bcf2cad5bd6475d4c2b6192 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Thu, 20 Sep 1990 03:02:26 +0000 Subject: [PATCH] Add nbits = 0 case to copy_bits to compensate for division bug in gcc. 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v7/src/microcode/bitstr.c b/v7/src/microcode/bitstr.c index 39beb2464..b4e115e9e 100644 --- a/v7/src/microcode/bitstr.c +++ b/v7/src/microcode/bitstr.c @@ -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) -- 2.25.1