[Python-bugs-list] [ python-Bugs-665616 ] Segfault while loading C module

SourceForge.net noreply@sourceforge.net
Fri, 10 Jan 2003 09:55:05 -0800


Bugs item #665616, was opened at 2003-01-10 11:38
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=665616&group_id=5470

Category: Extension Modules
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Jean-Baptiste Combes (jbcombes)
Assigned to: Nobody/Anonymous (nobody)
Summary: Segfault while loading C module

Initial Comment:
Note : This has only occured with gcc-2.95.3 / binutils
2.11.2 on Solaris 2.6.
It just works fine on Solaris 2.8 with GCC 3.2.

Problem described for the module struct.
Python segfaults after calling Py_InitModule4 from
initstruct in structmodule.c

More precisely, the segfault occurs when it tries to
get the length of the name of the first method in
struct_methods[]


Here the last part of the backtrace under gdb:

(gdb) run setup.py build_ext
Starting program: /tmp/python/Python-2.2.2/python
setup.py build_ext
running build_ext
skipping 'struct' extension (up-to-date)

Program received signal SIGSEGV, Segmentation fault.
0xef5a46fc in strlen ()
(gdb) bt
#0  0xef5a46fc in strlen ()
#1  0x20874 in PyString_FromString (str=0xd24c58 "") at
:111
#2  0xad440 in PyDict_SetItemString (v=0x177048,
key=0xd24c58 "", 
    item=0x10ebe8) at :1879
#3  0x683ac in Py_InitModule4 (name=0x2ad960 "",
methods=0xeed35754, 
    doc=0xeed34ce0 "Functions to convert between Python
values and C structs.\nPython strings are used to hold
the data representing the C struct\nand also as format
strings to describe the layout of data in the C
struct.\n"..., 
    passthrough=0x0, module_api_version=1536072) at :63
#4  0xeed247d8 in Py_NoSiteFlag ()
#5  0x64ed8 in _PyImport_LoadDynamicModule
(name=0xefffe1f8 "struct", 
    pathname=0xefffdd08
"/tmp/python/Python-2.2.2/build/lib.solaris-2.6-sun4m-2.2/struct.so",
fp=0xeed24798) at :53
#6  0x628d8 in load_module (name=0xefffe1f8 "struct",
fp=0xf06e8, 
    buf=0xefffdd08
"/tmp/python/Python-2.2.2/build/lib.solaris-2.6-sun4m-2.2/struct.so",
type=3) at :1380
#7  0x6385c in import_submodule (mod=0xd5848,
subname=0xefffe1f8 "struct", 
    fullname=0xefffe1f8 "struct") at :1910
#8  0x6335c in load_next (mod=0xd5848, altmod=0xd5848,
p_name=0xefffe1f8, 
    buf=0xefffe1f8 "struct", p_buflen=0xefffe1f4) at :1766
#9  0x62e20 in import_module_ex (name=0x0, globals=0x0,
locals=0x0, 
    fromlist=0x0) at :1617


One more note : #4 in the backtrace is obviously false,
it really calls initstruct...

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

>Comment By: Jean-Baptiste Combes (jbcombes)
Date: 2003-01-10 18:55

Message:
Logged In: YES 
user_id=116408

Last try this afternoon; after upgrading to GCC 3.2: python
builds and works OK.
I vote for the compiler bug.
Maybe adding something about this in the readme would be nice.

As sidenote zlib segfaults, but I have no time to dig into
it, sorry.

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

Comment By: Martin v. Löwis (loewis)
Date: 2003-01-10 18:35

Message:
Logged In: YES 
user_id=21627

Even though this has been reported before, nobody was ever
able to analyse the problem in so much detail as to find the
cause. It is believed to be a compiler bug.

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

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