Opened 11 years ago

Closed 10 years ago

#6794 closed Bugs (fixed)

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: Daniel James
Milestone: Boost 1.50.0 Component: quickbook
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

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 <https://bugs.gentoo.org/show_bug.cgi?id=411691>. 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.

Attachments (1)

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

Download all attachments as: .zip

Change History (4)

by markus@…, 11 years ago

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

comment:1 by Daniel James, 11 years ago

Component: Building Boostquickbook
Milestone: To Be DeterminedBoost 1.50.0
Owner: set to Daniel James
Status: newassigned

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 by Daniel James, 11 years ago

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

comment:3 by Daniel James, 10 years ago

Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.