Ronald Oussoren <ronaldousso...@mac.com> added the comment:

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

----------
nosy: +ronaldoussoren
type:  -> compile error

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13241>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to