[Boost-bugs] [Boost C++ Libraries] #1559: bjam fails when built with gcc4.2 and strict-aliasing enabled

Subject: [Boost-bugs] [Boost C++ Libraries] #1559: bjam fails when built with gcc4.2 and strict-aliasing enabled
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-01-07 21:32:53

#1559: bjam fails when built with gcc4.2 and strict-aliasing enabled
 Reporter: Kim Barrett <kab_at_[hidden]> | Type: Bugs
   Status: new | Milestone: Boost 1.36.0
Component: Building Boost | Version: Boost 1.34.1
 Severity: Problem | Keywords:
 Using gcc4.2.1 with boost-1.34.1 on x86 SUSE10.3, the bjam that I built
 segfaults when using it to build boost. A little bit of investigation
 leads me
 to believe that bjam may not be strict-aliasing correct. Specifically

 * a debug version of bjam does not exhibit this failure. (Note that the
 strict-alias analysis is not by default enabled at low optimization (-O0)

 * modifying the build.jam file to add the gcc --no-strict-aliasing option
 building a release version bjam also results in a bjam which does not
 this failure. Specifically, change tools/jam/src/build.jam, in the section
     ## GCC 2.x, 3.x, 4.x
     toolset gcc gcc : "-o " : -D
         : -pedantic
 - [ opt --release : [ opt --symbols : -g : -s ] -O3 ]
 + [ opt --release : [ opt --symbols : -g : -s ] -O3 --no-strict-

 Note that this modification is not appropriate as is for actual merging
 boost, because (I'm fairly sure) gcc2.x does not support the
 --[no-]strict-aliasing options. And of course, it might be preferable to
 out what is really wrong (probably in the bjam source code) and fix it
 That would likely require a much better understanding of the bjam source
 than I presently have.

 * testing

 BOOST_SRC_ROOT := root of boost-1.34.1 source tree
 BOOST_BUILD_ROOT := root of boost-1.34.1 build tree

 - modify $BOOST_SRC_ROOT/tools/jam/src/build.sh, adding "--symbols" option
 the invocation of ./bootstrap/jam0 at the end of the file, in order to get
 debugging symbols in the final bjam, so that we can get a useful
 Note that if "--debug" added instead of "--symbols", the failure does not

 cd $BOOST_SRC_ROOT/tools/jam/src
 gdb ./tools/jam/src/bin.linuxx86/bjam
 (gdb) run toolset=gcc \
     variant=release \
     threading=multi \
     link=shared \
     --build-dir=$BOOST_BUILD_ROOT \
     --layout=system \
     --without-graph \
     --without-program_options \
     --without-regex \
     --without-signals \
     --without-wave \

 Works if bjam built with --no-strict-aliasing. Fails as follows if bjam
 without that option.

 Program received signal SIGSEGV, Segmentation fault.
 0x0804ca4c in hashitem (hp=0x80db298, data=0xbfa21734, enter=1) at
 172 keyval = *b;
 (gdb) bt
 #0 0x0804ca4c in hashitem (hp=0x80db298, data=0xbfa21734, enter=1) at
 #1 0x080591a7 in file_info (filename=0x306000a <Address 0x306000a out of
 bounds>) at filesys.c:48
 #2 0x0805e2d3 in file_dirscan (dir=0x8072754 "/usr/share/boost-build",
 func=0x805a080 <builtin_glob_back>, closure=0xbfa21860)
     at fileunix.c:212
 #3 0x0805a7bc in builtin_glob (parse=0x80775b8, frame=0xbfa21a90) at
 #4 0x0804aa31 in evaluate_rule (rulename=0x0, frame=0xbfa21a90) at
 #5 0x0804aff7 in compile_rule (parse=0x8083be0, frame=0xbfa22544) at
 #6 0x08049884 in compile_append (parse=0x8083c10, frame=0xbfa22544) at
 #7 0x0804b146 in compile_local (parse=0x8085e90, frame=0xbfa22544) at
 #8 0x0804b1c4 in compile_local (parse=0x8085ec0, frame=0xbfa22544) at
 #9 0x080532de in parse_file (f=0x806718b "+", frame=0xbfa22544) at
 #10 0x0804e5f5 in main (argc=14, argv=0xbfa22664, arg_environ=Cannot
 memory at address 0x3060012
 ) at jam.c:453

Ticket URL: <http://svn.boost.org/trac/boost/ticket/1559>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC