Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#977 closed Bugs (fixed)

bjam crashes when compiled with gcc 4.2

Reported by: ismail@… Owned by: René Rivera
Milestone: Component: bjam
Version: Boost.Jam 3.1.14 Severity: Showstopper
Keywords: Cc:

Description

This is reported a year ago to Debian bugtracker it seems [1]. Bjam crashes when compiled with gcc 4.2.0 :

southpark boost_1_34_0 # ./tools/jam/src/bin.linuxx86/bjam zsh: segmentation fault ./tools/jam/src/bin.linuxx86/bjam

Debian bug report has a nice backtrace too.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=367825

Attachments (1)

patch-tools_jam_src_build.jam (492 bytes ) - added by barner@… 15 years ago.
Build bjam with -fno-strict-aliasing (fixes build with gcc 4.2.0)

Download all attachments as: .zip

Change History (16)

comment:1 by René Rivera, 15 years ago

Component: Building Boostbjam
Owner: set to René Rivera
Status: newassigned
Version: Boost.Jam 3.1.14

comment:2 by ismail@…, 15 years ago

Any news on this one?

comment:3 by barner@…, 15 years ago

Building bjam with -fno-strict-aliasing fixes this problem for me (on FreeBSD 7/amd64, gcc 4.2.0).

I will attach a patch that is based on http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=22;filename=boost.diff;att=1;bug=367825

by barner@…, 15 years ago

Build bjam with -fno-strict-aliasing (fixes build with gcc 4.2.0)

comment:4 by ismail@…, 15 years ago

Thats just a workaround, not a real fix, recently David Turner fixed ftjam for this bug. His changes could be backported.

in reply to:  4 ; comment:5 by René Rivera, 15 years ago

Replying to ismail@pardus.org.tr:

Thats just a workaround, not a real fix, recently David Turner fixed ftjam for this bug. His changes could be backported.

Do you have a reference for the changes that fix it? I'd really like to fix this in bjam but I've had no luck in finding out what's going wrong.

comment:6 by ismail@…, 15 years ago

http://david.freetype.org/jam/ftjam-2.5.3rc2.tar.bz2 is the fixed version as far as I know. For spesific changes you would have to ask David.

comment:7 by barner@…, 15 years ago

One more data point:

g++42 (GCC) 4.2.1 20070627 (prerelease) does not exhibit this problem (tested on FreeBSD 6.2-STABLE/i386), while g++ (GCC) 4.2.0 20070514 [FreeBSD] (tested on FreeBSD 7.0/amd64) does.

Since the original reporter also spoke about g++ 4.2.0, the problem seems to related to the compiler version, and not to the CPU architecture. In the debian bug report mentioned above someone reports the problem is present on i386 (with g++ 4.2.0).

in reply to:  7 comment:8 by anonymous, 15 years ago

Replying to barner@FreeBSD.org:

One more data point:

g++42 (GCC) 4.2.1 20070627 (prerelease) does not exhibit this problem (tested on FreeBSD 6.2-STABLE/i386), while g++ (GCC) 4.2.0 20070514 [FreeBSD] (tested on FreeBSD 7.0/amd64) does.

Nice one! I tried with gcc version 4.2.1 20070627 (prerelease) (Pardus Linux), I can't produce the bug either. So looks like its fixed for gcc 4.2.1.

Regards, ismail

comment:9 by bk@…, 15 years ago

Hm, this bug seems to be quite odd to reproduce. It reproduces here with this gcc:

Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.2.1 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --program-suffix=-4.2 --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux Thread model: posix gcc version 4.2.1 20070705 (prerelease) (SUSE Linux)

Other architectures with equivalent gcc also fail: i386 ia64, ppc, ppc64, s390, s390x (no platform to which we have works)

Now the odd thing: It seems it worked with the same gcc version before, same sources, just in the previous rebuild of all openSUSE packages (I still try to verify this, as the boost-jam tarball has no testsuite, the segfault was not detected directly, only when trying to builld boost itself)

The main change in gcc42 before that was an update from suse-gcc-4_2-branch head (r126079) to suse-gcc-4_2-branch head (r126359)

glibc was changes to the lastest glibc-2.6 head, shortly before.

Anyway, we are applying the change regarding-fno-strict-aliasing in our builds.

If I'd have a vote, as that should not be a major performance isssue for jam, I'd just apply the workaround if you are not going to look for the real fix. Pity that you need yor own jam!

comment:10 by ismail@…, 15 years ago

Bad news, I can reproduce the bug with gcc 4.2.1 and boost 1.34.1 :(

comment:11 by jrowe@…, 15 years ago

I can also attest that gcc 4.2.1 and boost 1.34.1 produce this problem on a Sparc running Solaris 2.8. Adding -fno-strict-aliasing allows for success.

comment:12 by René Rivera, 15 years ago

Resolution: fixed
Status: assignedclosed

Alternate version of the patch applied. Still wish I could find the real cause of the problem :-(

comment:13 by anonymous, 15 years ago

This issue is still occurring for me with gcc 4.2.3 and boost 1.34.1 in Ubuntu. Using -fno-strict-aliasing fixed the problem. I thought it worth mentioning since apparently no recent gcc changes have cured the underlying problem, alas.

in reply to:  5 comment:15 by Steven Watanabe, 11 years ago

Replying to grafik:

Replying to ismail@pardus.org.tr:

Thats just a workaround, not a real fix, recently David Turner fixed ftjam for this bug. His changes could be backported.

Do you have a reference for the changes that fix it? I'd really like to fix this in bjam but I've had no luck in finding out what's going wrong.

I think the problem is casting to HASHDATA * *. I'll fix this properly soon.

Note: See TracTickets for help on using tickets.