RedHat 9 _random failure under -pg (was Re: [Python-Dev] Startup time) (original) (raw)

Jeff Epler jepler@unpythonic.net
Tue, 6 May 2003 13:57:50 -0500


On Tue, May 06, 2003 at 01:36:00PM -0500, Jeff Epler wrote:

(gdb) run -c "import random" Starting program: /usr/src/Python-2.3b1/python -c "import random" [New Thread 1074963072 (LWP 28408)]

Program received signal SIGILL, Illegal instruction. [Switching to Thread 1074963072 (LWP 28408)] 0x08109aa0 in subtypegetsetsfull () (gdb) where #0 0x08109aa0 in subtypegetsetsfull () #1 0x4001c743 in randomnew (type=0x4001c738, args=0x4012c02c, kwds=0x0) at /usr/src/Python-2.3b1/Modules/randommodule.c:439 (gdb) ptype subtypegetsetsfull type = struct PyGetSetDef { [...]

gcc is generating plainly bogus code for this simple function random_new: 00001738 : 1738: 55 push %ebp 1739: 89 e5 mov %esp,%ebp 173b: 56 push %esi 173c: 53 push %ebx 173d: ff 93 7c 00 00 00 call *0x7c(%ebx)

(for those of you who don't read x86 assembly, the first 4 functions are part of a standard function prologue. The fifth instruction is a call through a function pointer, but the register's value at this point is undefined. This is not the call to type->tp_alloc(), correct code for that is just below)

Well, this may have been false alarm -- when I removed -pg from OPT in the Makefile, './python -c "import random"' works. So this is a problem only when profiling is enabled. Is this intended to work?

In any case, the fact that the disassembly is so plainly bogus tends to imply that this is a gcc bug, not anything that Python can fix.

Jeff