This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc trunk vs python

Hello Jack,

I has been almost a week since you mailed your question. I hope my answer is still relevant.

Jack Howarth wrote:
   Has anyone tried building python 2.4.3 using gcc trunk? The current gcc 4.2
seems to introduce a new regression in the Python testsuite...

test test_builtin failed -- Traceback (most recent call last):
File "/Users/howarth/Python-2.4.3/Lib/test/", line 233, in test_divmod
(sys.maxint+1, 0))
AssertionError: (0, -2147483648) != (2147483648L, 0)
I peeked in the python code in question:
 self.assertEqual(divmod(-sys.maxint-1, -1), (sys.maxint+1, 0))

Can you run:
shell$ python
Python 2.3.4 (#1, Feb  6 2006, 10:38:46)
[GCC 4.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> divmod(-sys.maxint-1, -1)
(2147483648L, 0L)
>>> (sys.maxint+1, 0)
(2147483648L, 0)
>>> divmod(-sys.maxint-1, -1) == (sys.maxint+1, 0)
How are your results different than the above?

It smells of a bug in python interpreter. Seems like a signed integer overflows (the C standard says this is undefined). If that is true then |-fwrapv may work-around the python bug.

Michael |

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]