diff options
| author | Tim Peters <tim.peters@gmail.com> | 2003-05-05 20:39:43 +0000 | 
|---|---|---|
| committer | Tim Peters <tim.peters@gmail.com> | 2003-05-05 20:39:43 +0000 | 
| commit | c7bc0b98e7cd2190a03da1a5269cdaaea711429e (patch) | |
| tree | 705de58b5defe91503347fc18f5bbaae3b3e3fb5 | |
| parent | ce6829ade0071e5463a5dc5cde7bbb01667073d5 (diff) | |
| download | cpython-git-c7bc0b98e7cd2190a03da1a5269cdaaea711429e.tar.gz | |
SF patch 730594:  assert from longobject.c, line 1215.
Some version of gcc in the "RTEMS port running on the Coldfire (m5200)
processor" generates bad code for a loop in long_from_binary_base(),
comparing the wrong half of an int to a short.  The patch changes the
decl of the short temp to be an int temp instead.  This "simplifies"
the code enough that gcc no longer blows it.
| -rw-r--r-- | Objects/longobject.c | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 15743f79a0..52c30c2be8 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1201,8 +1201,8 @@ long_from_binary_base(char **str, int base)  	bits_in_accum = 0;  	pdigit = z->ob_digit;  	while (--p >= start) { -		unsigned char ch = (unsigned char)*p; -		digit k; +		int k; +		char ch = *p;  		if (ch <= '9')  			k = ch - '0'; @@ -1212,8 +1212,8 @@ long_from_binary_base(char **str, int base)  			assert(ch >= 'A');  			k = ch - 'A' + 10;  		} -		assert(k < base); -		accum |= k << bits_in_accum; +		assert(k >= 0 && k < base); +		accum |= (twodigits)(k << bits_in_accum);  		bits_in_accum += bits_per_char;  		if (bits_in_accum >= SHIFT) {  			*pdigit++ = (digit)(accum & MASK);  | 
