[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)
 levels.)

 * modifying the build.jam file to add the gcc --no-strict-aliasing option
 when
 building a release version bjam also results in a bjam which does not
 exhibit
 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-
 aliasing
 ]

 Note that this modification is not appropriate as is for actual merging
 into
 boost, because (I'm fairly sure) gcc2.x does not support the
 --[no-]strict-aliasing options. And of course, it might be preferable to
 figure
 out what is really wrong (probably in the bjam source code) and fix it
 there.
 That would likely require a much better understanding of the bjam source
 base
 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
 to
 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
 backtrace.
 Note that if "--debug" added instead of "--symbols", the failure does not
 occur.

 cd $BOOST_SRC_ROOT/tools/jam/src
 ./build.sh
 cd $BOOST_SRC_ROOT
 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 \
     --without-python

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

 Program received signal SIGSEGV, Segmentation fault.
 0x0804ca4c in hashitem (hp=0x80db298, data=0xbfa21734, enter=1) at
 hash.c:172
 172 keyval = *b;
 (gdb) bt
 #0 0x0804ca4c in hashitem (hp=0x80db298, data=0xbfa21734, enter=1) at
 hash.c:172
 #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
 builtins.c:655
 #4 0x0804aa31 in evaluate_rule (rulename=0x0, frame=0xbfa21a90) at
 compile.c:1036
 #5 0x0804aff7 in compile_rule (parse=0x8083be0, frame=0xbfa22544) at
 compile.c:597
 #6 0x08049884 in compile_append (parse=0x8083c10, frame=0xbfa22544) at
 compile.c:127
 #7 0x0804b146 in compile_local (parse=0x8085e90, frame=0xbfa22544) at
 compile.c:481
 #8 0x0804b1c4 in compile_local (parse=0x8085ec0, frame=0xbfa22544) at
 compile.c:505
 #9 0x080532de in parse_file (f=0x806718b "+", frame=0xbfa22544) at
 parse.c:139
 #10 0x0804e5f5 in main (argc=14, argv=0xbfa22664, arg_environ=Cannot
 access
 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