This is the mail archive of the gcc@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 4.4.1/linux 64bit: code crashes with -O3, works with -O2


Hi,

i'd like to submit a bug report. I read the instructions on
http://gcc.gnu.org/bugs, but i do not really know where the crash
happens and what causes the crash to happen. I therefore just wrote
the instructions below - they're simple. If you still need more
specific stuff, please send me a private message and help me a little
bit...

I have a library which uses automake/autoconf; it does not have
dependencies. If i build the non-debug version, files are compiled
with -O3. Then the library causes a segfault. If i compile with -O2,
everything works. Actually it's enough if i compile 2 files with -O2,
all others with -O3, and everything's fine.

If i run the program under valgrind, it runs without failure. gdb
shows that a pointer is bogus.

My system is a 64bit Ubuntu 9.04 linux, but i also saw it on other
64bit distributions (but it works fine on 32bit).
uname -a says:
Linux wintermute 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 17:01:44
UTC 2009 x86_64 GNU/Linux

My gcc is
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.4.1-4ubuntu8'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --enable-multiarch --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-objc-gc --disable-werror
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8)

I did some tests with the following versions (again, only x86_64. x86
works fine):
4.1.3 20080704 (prerelease) (Debian 4.1.2-27) - works
4.3.4 (Debian 4.3.4-6) - works
4.4.1 on Gentoo - fails
4.4.3 20100108 (prerelease) (Ubuntu 4.4.2-9ubuntu3) - fails

To reproduce, these steps are necessary:

wget http://crupp.de/dl/hamsterdb-1.1.1.tar.gz
tar -zxvf hamsterdb-1.1.1.tar.gz
cd hamsterdb-1.1.1
./configure --enable-internal
make
make test # this will segfault after a few tests

Now change the CFLAGS to -O2 in src/Makefile, and rebuild the two
files which depend on freelist.c
cd src
vi Makefile # -O3 -> -O2
touch freelist.c
make # will build two files - freelist.c and freelist_v2.c
cd ../unittests
make
./test # this will run

Best regards
Christoph


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