[Patches] [ python-Patches-730594 ] assert from longobject.c, line 1215

SourceForge.net noreply@sourceforge.net
Wed, 30 Apr 2003 21:43:59 -0700


Patches item #730594, was opened at 2003-05-01 14:43
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=730594&group_id=5470

Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Chris Johns (cjohns)
Assigned to: Nobody/Anonymous (nobody)
Summary: assert from longobject.c, line 1215

Initial Comment:
RTEMS port running on the Coldfire (m5200) processor.
RTEMS is version 4.6.0pre3 and the lastest RTEMS tool
set. The target is m68k-rtems.

GCC 3.2.2 and GCC 3.2.3 both cause the assert in the file:

 Objects/longmodule.c:1215

The assert test is in the function 'long_from_binary_base':

  assert(k < base);

The assert and related code is valid, gcc is generating
bad code. The bad code is related to the "digit"
variable k being a short and the base being an int
(32bit on Coldfire). GCC seems to get a little confused
about which 16bit half to compare against.

The simple fix is to make "k" an int and so be the same
size as base.  The 'k' variable is an int in the loop
just above that figures out the total number of bits
needed.

This change also generated faster code for the
Coldfire. I know a selection of one CPU is not a valid
analysis, how-ever base and k being the same seemed to
help gcc.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=730594&group_id=5470