Opened 12 years ago

Last modified 12 years ago

#4381 new Bugs

GCC previous to 4.3.x does not implement inclass member initialization

Reported by: Mario Ferreira <lioux@…> Owned by: Dave Abrahams
Milestone: Boost 1.44.0 Component: python USE GITHUB
Version: Boost 1.43.0 Severity: Problem
Keywords: BOOST_NO_INCLASS_MEMBER_INITIALIZATION Cc:

Description

o Add compile gcc option to make sure that boost compilation toolchain

acknowledges that gcc versions prior to 4.3.x do not implement inclass member initialization.

o This enables libtorrent-rasterbar 1.4.x to build python

bindings with the base system gcc on FreeBSD 8.x. Previously, we would have had to resort gcc 4.3+ ports.

o Further information can be found at

http://www.freebsd.org/cgi/query-pr.cgi?pr=144336

Attachments (1)

patch-boost__config__compiler__gcc.hpp (477 bytes ) - added by Mario Ferreira <lioux@…> 12 years ago.
Define BOOST_NO_INCLASS_MEMBER_INITIALIZATION on gcc versions prior to 4.3.x

Download all attachments as: .zip

Change History (8)

by Mario Ferreira <lioux@…>, 12 years ago

Define BOOST_NO_INCLASS_MEMBER_INITIALIZATION on gcc versions prior to 4.3.x

comment:1 by anonymous, 12 years ago

Component: Noneconfig
Owner: set to John Maddock

comment:2 by John Maddock, 12 years ago

Resolution: invalid
Status: newclosed

Sorry, but this is very much the wrong patch - gcc has implemented this since gcc-2.95.

Whatever the issue is, this is the wrong solution.

comment:3 by Mario Ferreira <lioux@…>, 12 years ago

Resolution: invalid
Status: closedreopened

Humm, that patch fixed the build of libtorrent-rasterbar 1.4.10 python

bindings with gcc 4.2.1 on FreeBSD 8-STABLE.

$ uname -a FreeBSD exxodus.fedaykin.here 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #10: Thu Jun 17 12:28:13 BRT 2010 lioux@exxodus:/usr/obj/usr/src/sys/LIOUX amd64

If that is not the proper patch, what other gcc 4.2.1 compilation

glitch could have been avoided by setting that flag?

I recompiled boost-libs without the patch then tried to compile the

python bindings again. Then I got the following error:


/usr/local/libexec/ccache/cc -DNDEBUG -O2 -pipe -march=athlon64 -Dwchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -fno-strict-aliasing -O2 -pipe -march=athlon64 -fno-strict-aliasing -fPIC -I/usr/local/include -I/usr/local/include/libtorrent -I/usr/local/include -I/usr/include/openssl -I/usr/local/include/python2.6 -c src/extensions.cpp -o build/temp.freebsd-8.1-PRERELEASE-amd64-2.6/src/extensions.o -DHAVE_SSL -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION /usr/local/include/boost/type_traits/detail/cv_traits_impl.hpp: In instantiation of 'const bool boost::detail::cv_traits_imp<<unnamed>::torrent_plugin_wrap*>::is_volatile': /usr/local/include/boost/type_traits/is_volatile.hpp:52: instantiated from 'boost::is_volatile<<unnamed>::torrent_plugin_wrap>' /usr/local/include/boost/type_traits/remove_const.hpp:54: instantiated from 'boost::detail::remove_const_impl<<unnamed>::torrent_plugin_wrap>' /usr/local/include/boost/type_traits/remove_const.hpp:61: instantiated from 'boost::remove_const<<unnamed>::torrent_plugin_wrap>' /usr/local/include/boost/python/object/pointer_holder.hpp:127: instantiated from 'void* boost::python::objects::pointer_holder<Pointer, Value>::holds(boost::python::type_info, bool) [with Pointer = boost::shared_ptr<<unnamed>::torrent_plugin_wrap>, Value = <unnamed>::torrent_plugin_wrap]' src/extensions.cpp:168: instantiated from here /usr/local/include/boost/type_traits/detail/cv_traits_impl.hpp:38: internal compiler error: in make_rtl_for_nonlocal_decl, at cc1plus/../../../../contrib/gcc/cp/decl.c:4971 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. error: command '/usr/local/libexec/ccache/cc' failed with exit status 1 * Error code 1 1 error * Error code 1


Then I tried to obtain the preprocessed source with:

$ gcc -v -save-temps -DNDEBUG -O2 -pipe -march=athlon64 -Dwchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -fno-strict-aliasing -O2 -pipe -march=athlon64 -fno-strict-aliasing -fPIC -I/usr/local/include -I/usr/local/include/libtorrent -I/usr/local/include -I/usr/include/openssl -I/usr/local/include/python2.6 -c src/extensions.cpp -o build/temp.freebsd-8.1-PRERELEASE-amd64-2.6/src/extensions.o -DHAVE_SSL -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION

The source and preprocessed files

./src/extensions.cpp ./extensions.ii ./extensions.s

can be found at

http://people.freebsd.org/~lioux/extensions_src__and__preprocessed.tar.gz.


gcc: warning: -pipe ignored because -save-temps specified Using built-in specs. Target: amd64-undermydesk-freebsd Configured with: FreeBSD/amd64 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD]

/usr/libexec/cc1plus -E -quiet -v -I/usr/local/include

-I/usr/local/include/libtorrent -I/usr/local/include -I/usr/include/openssl -I/usr/local/include/python2.6 -D_LONGLONG -DNDEBUG -Dwchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -DHAVE_SSL -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION src/extensions.cpp -march=athlon64 -march=athlon64 -fno-strict-aliasing -fPIC -O2 -O2 -fpch-preprocess -o extensions.ii ignoring duplicate directory "/usr/include" ignoring duplicate directory "/usr/local/include" #include "..." search starts here: #include <...> search starts here:

/usr/local/include /usr/local/include/libtorrent /usr/include/openssl /usr/local/include/python2.6 /usr/include/c++/4.2 /usr/include/c++/4.2/backward /usr/include

End of search list.

/usr/libexec/cc1plus -fpreprocessed extensions.ii -quiet -dumpbase

extensions.cpp -march=athlon64 -march=athlon64 -auxbase-strip build/temp.freebsd-8.1-PRERELEASE-amd64-2.6/src/extensions.o -O2 -O2 -version -fno-strict-aliasing -fPIC -o extensions.s GNU C++ version 4.2.1 20070719 [FreeBSD] (amd64-undermydesk-freebsd)

compiled by GNU C version 4.2.1 20070719 [FreeBSD].

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 00c8d3715b4cad4e2f9456e93053adc2 /usr/local/include/boost/type_traits/detail/cv_traits_impl.hpp: In instantiation of 'const bool boost::detail::cv_traits_imp<<unnamed>::torrent_plugin_wrap*>::is_volatile': /usr/local/include/boost/type_traits/is_volatile.hpp:52: instantiated from 'boost::is_volatile<<unnamed>::torrent_plugin_wrap>' /usr/local/include/boost/type_traits/remove_const.hpp:54: instantiated from 'boost::detail::remove_const_impl<<unnamed>::torrent_plugin_wrap>' /usr/local/include/boost/type_traits/remove_const.hpp:61: instantiated from 'boost::remove_const<<unnamed>::torrent_plugin_wrap>' /usr/local/include/boost/python/object/pointer_holder.hpp:127: instantiated from 'void* boost::python::objects::pointer_holder<Pointer, Value>::holds(boost::python::type_info, bool) [with Pointer = boost::shared_ptr<<unnamed>::torrent_plugin_wrap>, Value = <unnamed>::torrent_plugin_wrap]' src/extensions.cpp:168: instantiated from here /usr/local/include/boost/type_traits/detail/cv_traits_impl.hpp:38: internal compiler error: in make_rtl_for_nonlocal_decl, at cc1plus/../../../../contrib/gcc/cp/decl.c:4971


The offending 4971 from decl.c follows:


4963: /* If we see a class member here, it should be a static data 4964: member. */ 4965: if (DECL_LANG_SPECIFIC (decl) && DECL_IN_AGGR_P (decl)) 4966: { 4967: gcc_assert (TREE_STATIC (decl)); 4968: /* An in-class declaration of a static data member should be 4969: external; it is only a declaration, and not a definition. */ 4970: if (init == NULL_TREE) 4971: gcc_assert (DECL_EXTERNAL (decl)); 4972: }


comment:4 by John Maddock, 12 years ago

Component: configPython
Owner: changed from John Maddock to Dave Abrahams
Status: reopenednew

This is strange as our regression tests are passing for that compiler.

Also are you compiling Boost, or something that uses Boost?

The fact that you're getting an internal compiler error tells us that it's a compiler bug, the thing is this: setting BOOST_NO_INCLASS_MEMBER_INITIALIZATION is too big a sledgehammer to fix this particular issue with.

I'm reassigning this to the Boost.Python guys, in the meantime if you can produce a reduced test case that would also help a lot.

John.

comment:5 by Steven Watanabe, 12 years ago

Could the issue be related to the unnamed namespace?

comment:6 by Mario Ferreira <lioux@…>, 12 years ago

I can compile boost 1.43.0 under FreeBSD 8's base GCC 4.2.1 without setting BOOST_NO_INCLASS_MEMBER_INITIALIZATION.

BOOST_NO_INCLASS_MEMBER_INITIALIZATION is required to build rasterbar

libtorrent 1.4.10 python bindings. rasterbar 1.4.10 can be built but not the python bindings.

The offending file for rasterbar 1.4.10 is extensions.cpp as my previous post documents. This is under GCC 4.2.1 available in the FreeBSD 8-STABLE base installation.

Please let me know if there is anything I can do to help.

comment:7 by John Maddock, 12 years ago

FYI the proposed patch here is already causing other bug reports: https://svn.boost.org/trac/boost/ticket/4669

Note: See TracTickets for help on using tickets.