This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc on mipsel: -O2 leads to SEGFAULT on very large function


Hi!

I came over this bug after the latest upload of enigmail to debian. The 
build only failed on mips and on mipsel, on mipsel with the message "Bus 
error". 

https://buildd.debian.org/fetch.cgi?pkg=enigmail;ver=2%3A1.0.1-2;arch=mipsel;stamp=1275567604

The command "install-xpi" that exposes this bus error is a python script. It 
uses the package python-rdflib, which is an RDF library. The parser for the 
supported RDF query language is generated C code. 

I don't have shell access to a mipsel machine, so I did all my tests in qemu 
using -M malta as machine type.

The first thing I tried is to compile without optimization. The error no 
longer occured. 

So I tried to reduce the largest function in the generated parser by 
removing debug code first that shouldn't change the results. Unfortunately, 
after the removal of one type of these debug blocks, the "Bus error" no 
longer occured. 

So I did a binary search on the number of blocks I could remove before the 
problem disappears. The result is that I have two versions of the parser 
that only differ in 8 lines with one exposing the bug, the other not. 

The command-line is 
$ gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -g -O2 -fPIC -I/usr/include/python2.5 -c src/bison/SPARQLParser.c 
-o build/temp.linux-mips-2.5/src/bison/SPARQLParser.o

The two versions of the parser are available from

http://wserver.wm1.at/~willi/debian/gcc_mipsel_bug/

The source package is available from

http://packages.debian.org/source/sid/rdflib

A stripped down version of install-xpi that's enough to trigger the bug is 
available from the following Debian bug:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584327

It's then enough to run 
$ ./install-xpi install.rdf 

to trigger the bug.

Is this a gcc bug? In theory, it could also be a python bug (or some other 
python extension's bug) but this is very unlikely (I think) because the 
problem only occurs with optimization enabled and only on mipsel and maybe 
mips. (The build on of mips fails at the same position (build log), but with 
SEGFAULT. As I haven't set up a mips machine, I can't say whether it looks 
like the same issue.)

WM

Please CC: me on replies.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]