public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ndbecker2 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53455] boost::python segfault
Date: Thu, 24 May 2012 14:29:00 -0000	[thread overview]
Message-ID: <bug-53455-4-8kgVmJNmcZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53455-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53455

Neal Becker <ndbecker2 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ndbecker2 at gmail dot com

--- Comment #6 from Neal Becker <ndbecker2 at gmail dot com> 2012-05-24 14:22:43 UTC ---
I believe I hit the same bug, using extract on a polymorphic type.

In the old code (which segfaults), I used make_constructor, passing object to
it, and using 
extract.

In the new code (which does not segfault), I don't use make_constructor, just
use bp::init.  My segfault 
is gone.  Maybe just luck?

valgrind python test_constellation.py 
==6162== Memcheck, a memory error detector
==6162== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==6162== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==6162== Command: python test_constellation.py
==6162== 
==6162== Invalid read of size 8
==6162==    at 0x11B79748:
boost::python::objects::polymorphic_id_generator<QAMconstellation<double>
>::execute(void*) (inheritance.hpp:43)
==6162==    by 0x13F585A3: boost::(anonymous namespace)::convert_type(void*,
boost::python::type_info, boost::python::type_info, bool) (in
/usr/local/src/boost_1_49_0.hg.nondarray/stage/lib/libboost_python.so.1.49.0)
==6162==    by 0x11B857D9:
boost::python::objects::pointer_holder<std::auto_ptr<QAMconstellation<double>
>, QAMconstellation<double> >::holds(boost::python::type_info, bool)
(pointer_holder.hpp:150)
==6162==    by 0x13F50006: boost::python::objects::find_instance_impl(_object*,
boost::python::type_info, bool) (in
/usr/local/src/boost_1_49_0.hg.nondarray/stage/lib/libboost_python.so.1.49.0)
==6162==    by 0x13F4B304:
boost::python::converter::rvalue_from_python_stage1(_object*,
boost::python::converter::registration const&) (in
/usr/local/src/boost_1_49_0.hg.nondarray/stage/lib/libboost_python.so.1.49.0)
==6162==    by 0x11B82F02:
boost::python::converter::arg_rvalue_from_python<constellation<double>
const&>::arg_rvalue_from_python(_object*) (arg_from_python.hpp:299)
==6162==    by 0x11B81BEA: boost::python::arg_from_python<constellation<double>
const&>::arg_from_python(_object*) (arg_from_python.hpp:70)
...

This particular code uses inheritance (I rarely use it).  It looks something
like:


BOOST_PYTHON_MODULE(constellation) {

  boost::numpy::initialize();

  class_<constellation<double>, boost::noncopyable > ("constellation_base",
no_init)
    .def ("__call__", &apply_constellation<double>)
    .def ("hard_decision", &apply_hard_decision<double>)
    .add_property ("size", &constellation<double>::size)
    .add_property ("gain", &constellation<double>::gain)
    ;

  class_<QAMconstellation<double> , bases<constellation<double> > >
("QAMconstellation", no_init)
    .def ("__init__", make_constructor (qam_from_object<double>))
    .add_property ("map", &get_map)
    .def_pickle(const_pickle_suite<double>())
    ;
...


  parent reply	other threads:[~2012-05-24 14:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 17:41 [Bug c++/53455] New: g++ builds segfault in boost::python j.wielicki at sotecware dot net
2012-05-22 17:42 ` [Bug c++/53455] " j.wielicki at sotecware dot net
2012-05-22 17:50 ` j.wielicki at sotecware dot net
2012-05-22 18:36 ` s_gccbugzilla at nedprod dot com
2012-05-22 19:08 ` rene.kuettner at gmail dot com
2012-05-22 20:08 ` [Bug c++/53455] boost::python segfault s_gccbugzilla at nedprod dot com
2012-05-24 14:29 ` ndbecker2 at gmail dot com [this message]
2012-05-24 14:42 ` org.gnu.gcc.bugtracker at sotecware dot net
2012-05-24 15:10 ` org.gnu.gcc.bugtracker at sotecware dot net
2012-06-13 22:14 ` mbec at gmto dot org
2012-06-14  0:47 ` mbec at gmto dot org
2012-06-14 11:49 ` s_gccbugzilla at nedprod dot com
2012-06-14 12:51 ` redi at gcc dot gnu.org
2012-06-14 13:15 ` redi at gcc dot gnu.org
2012-06-14 13:22 ` redi at gcc dot gnu.org
2012-06-14 13:25 ` s_gccbugzilla at nedprod dot com
2012-06-14 13:27 ` org.gnu.gcc.bugtracker at sotecware dot net
2012-06-14 14:01 ` redi at gcc dot gnu.org
2012-06-14 15:15 ` s_gccbugzilla at nedprod dot com
2012-06-14 15:21 ` org.gnu.gcc.bugtracker at sotecware dot net
2012-06-14 15:45 ` redi at gcc dot gnu.org
2012-06-14 16:10 ` org.gnu.gcc.bugtracker at sotecware dot net
2012-06-14 16:16 ` s_gccbugzilla at nedprod dot com
2012-06-14 16:22 ` redi at gcc dot gnu.org
2012-06-14 16:24 ` redi at gcc dot gnu.org
2012-06-14 16:37 ` s_gccbugzilla at nedprod dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53455-4-8kgVmJNmcZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).