classification
Title: test_ctypes fail with clang
Type: behavior Stage:
Components: ctypes Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: theller Nosy List: donmez, jcea, ned.deily, theller
Priority: normal Keywords:

Created on 2010-09-14 12:05 by donmez, last changed 2010-11-24 10:19 by ned.deily. This issue is now closed.

Messages (5)
msg116392 - (view) Author: Ismail Donmez (donmez) * Date: 2010-09-14 12:05
This is probably a clang bug but this is the only test failing with clang:


======================================================================
FAIL: test_byte (ctypes.test.test_cfuncs.CFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_cfuncs.py", line 20, in test_byte
    self.assertEqual(self._dll.tf_b(-126), -42)
AssertionError: 43 != -42

======================================================================
FAIL: test_byte_plus (ctypes.test.test_cfuncs.CFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_cfuncs.py", line 26, in test_byte_plus
    self.assertEqual(self._dll.tf_bb(0, -126), -42)
AssertionError: 43 != -42

======================================================================
FAIL: test_short (ctypes.test.test_cfuncs.CFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_cfuncs.py", line 44, in test_short
    self.assertEqual(self._dll.tf_h(-32766), -10922)
AssertionError: 10923 != -10922

======================================================================
FAIL: test_short_plus (ctypes.test.test_cfuncs.CFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_cfuncs.py", line 50, in test_short_plus
    self.assertEqual(self._dll.tf_bh(0, -32766), -10922)
AssertionError: 10923 != -10922

======================================================================
FAIL: test_doubleresult (ctypes.test.test_functions.FunctionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_functions.py", line 143, in test_doubleresult
    self.assertEqual(result, -21)
AssertionError: 65771.0 != -21

======================================================================
FAIL: test_floatresult (ctypes.test.test_functions.FunctionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_functions.py", line 131, in test_floatresult
    self.assertEqual(result, -21)
AssertionError: 65771.0 != -21

======================================================================
FAIL: test_intresult (ctypes.test.test_functions.FunctionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_functions.py", line 105, in test_intresult
    self.assertEqual(result, -21)
AssertionError: 65771 != -21

======================================================================
FAIL: test_longdoubleresult (ctypes.test.test_functions.FunctionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cartman/Sources/py3k/Lib/ctypes/test/test_functions.py", line 155, in test_longdoubleresult
    self.assertEqual(result, -21)
AssertionError: 65771.0 != -21
msg122261 - (view) Author: Ismail Donmez (donmez) * Date: 2010-11-24 07:03
Problem seems to be in _ctypes_test.c . If you compile _ctypes_test.c with gcc problems disappears.
msg122267 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-24 10:02
Can you say exactly what arguments are given to clang for this compile?  (As you probably know, CPython builds on OS X for python.org installers use gcc, not clang.)
msg122269 - (view) Author: Ismail Donmez (donmez) * Date: 2010-11-24 10:03
No interesting option. But this looks like a clang bug, compiling _ctypes_test.c with -O0 fixes the issue. So this is a compiler optimization bug.
msg122271 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-24 10:19
OK, then if you care to follow up, I suggest pursuing with the Clang project.
History
Date User Action Args
2010-11-24 10:19:52ned.deilysetstatus: open -> closed
resolution: not a bug
messages: + msg122271
2010-11-24 10:03:41donmezsetmessages: + msg122269
2010-11-24 10:02:16ned.deilysetnosy: + ned.deily
messages: + msg122267
2010-11-24 07:03:34donmezsetmessages: + msg122261
2010-11-23 03:50:07jceasetnosy: + jcea
2010-09-14 12:05:46donmezcreate