Ticket #6794 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

boost-1.49.0 fails to build with gcc-4.6.2: boost/smart_ptr/intrusive_ptr.hpp:94:5: internal compiler error: Segmentation fault

Reported by: markus@… Owned by: danieljames
Milestone: Boost 1.50.0 Component: quickbook
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:


I believe this issue is specific to gcc-4.6.2, not with less than boost-1.49, and I have what I think is a fix. Here's the error:

gcc.compile.c++ ../bin.v2/tools/quickbook/src/gcc-4.6/release/link-static/pch-off/id_manager.o

"x86_64-pc-linux-gnu-g++" -ftemplate-depth-300 -O2 -pipe -march=amdfam10 -O3 -finline-functions -Wno-inline -Wall -g0 -DBOOST_ALL_NO_LIB=1 -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I".." -c -o "../bin.v2/tools/quickbook/src/gcc-4.6/release/link-static/pch-off/id_manager.o" "quickbook/src/id_manager.cpp"

In file included from ../boost/intrusive_ptr.hpp:16:0,

from quickbook/src/fwd.hpp:15, from quickbook/src/values.hpp:20, from quickbook/src/id_manager.hpp:14, from quickbook/src/id_manager.cpp:9:

../boost/smart_ptr/intrusive_ptr.hpp: In destructor ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = quickbook::file_info]’: ../boost/smart_ptr/intrusive_ptr.hpp:94:5: internal compiler error: Segmentation fault

You can find a full build log and preprocessed id_manager.cpp at <>. Basically I noticed that if I changed the optimization level to -O[01s] or if I removed -DNDEBUG (enabling assertions), it built without error. I came up with both an arbitrary patch, and one that I think makes sense (but itself could be arbitrary since I don't fully understand what the problem is):

--- boost_1_49_0/tools/quickbook/src/intrusive_base.hpp.orig 2012-04-14 00:26:49.360818878 -0700 +++ boost_1_49_0/tools/quickbook/src/intrusive_base.hpp 2012-04-14 00:27:10.214279871 -0700 @@ -21,7 +21,7 @@

intrusive_base() : ref_count_(0) {} intrusive_base(intrusive_base const&) : ref_count_(0) {} intrusive_base& operator=(intrusive_base const&) { return *this; }

  • ~intrusive_base() { assert(!ref_count_); }

+ virtual ~intrusive_base() { assert(!ref_count_); }

friend void intrusive_ptr_add_ref(T* ptr)

{ ++ptr->ref_count_; }

Usually base classes need a virtual destructor, though not if you know the actual type of the object when it's destroyed. Anyway, it works now.


boost-1.49.0-gcc462-intrusive_ptr.patch Download (595 bytes) - added by markus@… 3 years ago.
My patch (which was mangled in the bug description).

Change History

Changed 3 years ago by markus@…

My patch (which was mangled in the bug description).

comment:1 Changed 3 years ago by danieljames

  • Owner set to danieljames
  • Status changed from new to assigned
  • Component changed from Building Boost to quickbook
  • Milestone changed from To Be Determined to Boost 1.50.0

It didn't need to be virtual because the base class is never used directly. It should have been protected though. Anyway, I think I'll just remove intrusive_base. It's more hassle than it's worth.

Btw. the gcc bug seems to happen because the non-virtual destructor is hidden by a virtual destructor in one of the derived classes. A bit of an odd thing to do, but valid in this case.

comment:2 Changed 3 years ago by danieljames

(In [77998]) Quickbook: Remove intrusive_base. Refs #6794.

comment:3 Changed 3 years ago by danieljames

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [78210]) Quickbook: Merge from trunk. Fixes #6691, #6794


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.