This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients Julian, Nam.Nguyen, Oleg.Plakhotnyuk, Yury.Selivanov, barry, ezio.melotti, michael.foord, ned.deily, ronaldoussoren, vstinner, xapple
Date 2011-12-13.22:00:57
SpamBayes Score 2.7755576e-16
Marked as misclassified No
Message-id <1323813661.17.0.843566809445.issue13241@psf.upfronthosting.co.za>
In-reply-to
Content
The bug in the 'gcc' command is still present when using Xcode 4.2.1 (that is, the attached unicode.c miscompiles with "gcc -O3").

Clang (again from Xcode 4.2.1) compiles the file correctly, but fails to do a proper build the last few lines of the build log:

clang -bundle -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-3.3/Users/ronald/Projects/python/rw/cpython/Modules/_cursesmodule.o -L/usr/local/lib -lncurses -o build/lib.macosx-10.4-x86_64-3.3/_curses.so
/bin/sh: line 1: 84213 Segmentation fault: 11  CC='clang' LDSHARED='clang -bundle -undefined dynamic_lookup  ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' ./python.exe -E ./setup.py build
make: *** [sharedmods] Error 139

The last bit of a gdb stack trace:

#0  0x00007fff86cd94f0 in strlen ()
#1  0x000000010005bee1 in PyUnicode_FromString (u=0x4c <Address 0x4c out of bounds>) at unicodeobject.c:1735
#2  0x000000010003bb65 in PyDict_GetItemString (v=0x10075cc58, key=<value temporarily unavailable, due to optimizations>) at dictobject.c:2187
#3  0x000000010004eaf8 in add_getset [inlined] () at /Users/ronald/Projects/python/rw/cpython/Objects/typeobject.c:3771
#4  0x000000010004eaf8 in PyType_Ready (type=0x10159efb8) at typeobject.c:4109
#5  0x000000010159209a in PyInit__curses () at /Users/ronald/Projects/python/rw/cpython/Modules/_cursesmodule.c:3293
#6  0x00000001000c0e20 in _PyImport_LoadDynamicModule (name=0x1010f9f80, path=0x10074c750, fp=<value temporarily unavailable, due to optimizations>) at importdl.c:85
#7  0x00000001000beca0 in imp_load_dynamic (self=<value temporarily unavailable, due to optimizations>, args=<value temporarily unavailable, due to optimizations>) at import.c:3804
#8  0x000000010009f0c8 in call_function [inlined] () at /Users/ronald/Projects/python/rw/cpython/Python/ceval.c:4003

For some reason a clean rebuild got a failure in another location, this time in the Py_XDECREF call on line 2966 in ceval.c:

    while (!EMPTY()) {
        v = POP();
        Py_XDECREF(v);
    }

Due to the optimization level I couldn't get more information.

When I patch the Makefile to use '-O2' instead of '-O3' in CFLAGS the problems stays (obviously with full rebuild).

Patching the optimization level down to '-O1' gives a slightly better result, this time I get:

./python.exe -SE -m sysconfig --generate-posix-vars
Fatal Python error: Py_Initialize: unable to load the file system codec
SystemError: NULL result without error in PyObject_Call

BTW. I tried to build with srcdir==builddir and "./configure CC=clang" on an up-to-date OSX 10.7 system with Xcode 4.2.1.


Summary of compiler results:

- gcc-4.2 (i686-apple-darwin11-gcc-4.2.1):   unicode.c OK, build OK
- gcc (i686-apple-darwin11-llvm-gcc-4.2):    unicode.c fails, build fails
- clang: unicode.c OK, build fails
History
Date User Action Args
2011-12-13 22:01:01ronaldoussorensetrecipients: + ronaldoussoren, barry, vstinner, ned.deily, ezio.melotti, michael.foord, Yury.Selivanov, Julian, Nam.Nguyen, Oleg.Plakhotnyuk, xapple
2011-12-13 22:01:01ronaldoussorensetmessageid: <1323813661.17.0.843566809445.issue13241@psf.upfronthosting.co.za>
2011-12-13 22:00:58ronaldoussorenlinkissue13241 messages
2011-12-13 22:00:57ronaldoussorencreate