[proto, fusion] Segfault in for_each
I'm using boost 1.42. As part of a proto transform, I am flattening an expression tree of comma operators and sending it to fusion::transform followed by fusion::for_each, something like this: for_each(transform(flatten(expr), func1), func2) I am getting a segmentation fault in for_each. func1 does not appear to be invoked. Program output: Building type list: comma( comma( function( terminal(int_) , terminal(32) ) , function( terminal(float_) , terminal(32) ) ) , function( terminal(int_) , terminal(16) ) ) 3 items Program received signal SIGSEGV, Segmentation fault. 0x0804d52d in boost::proto::result_of::child_c<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::comma, boost::proto::argsns_::list2<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list2<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<Builder::keyword::int_>, 0l> > const&, Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<int const&>, 0l> > >, 2l> > const&, Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list2<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<Builder::keyword::float_>, 0l> > const&, Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<int const&>, 0l> > >, 2l> > const&>, 2l> > const&, 0l>::call (e=...) at /usr/include/boost/proto/traits.hpp:1544 (gdb) print e $1 = (const Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::comma, boost::proto::argsns_::list2<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list2<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<Builder::keyword::int_>, 0l> > const&, Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<int const&>, 0l> > >, 2l> > const&, Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list2<Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<Builder::keyword::float_>, 0l> > const&, Builder::Wrapper<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<int const&>, 0l> > >, 2l> > const&>, 2l> > &) @0x0: <error reading variable> Note the null expression reference. fusion::distance on a begin/end pair from the same sequence works as expected so I believe the sequence is at least well-formed. I've been wrestling with this for days. Any ideas on how to debug this? Thanks! -Dave
On 5/10/2010 6:53 PM, David A. Greene wrote:
I'm using boost 1.42. As part of a proto transform, I am flattening an expression tree of comma operators and sending it to fusion::transform followed by fusion::for_each, something like this:
for_each(transform(flatten(expr), func1), func2)
I am getting a segmentation fault in for_each.
<snip>
I've been wrestling with this for days. Any ideas on how to debug this?
Nope. But it'd probably help if you sent around a self-contained repro. -- Eric Niebler BoostPro Computing http://www.boostpro.com
On Monday 10 May 2010 21:15:42 Eric Niebler wrote:
I've been wrestling with this for days. Any ideas on how to debug this?
Nope. But it'd probably help if you sent around a self-contained repro.
I don't know what a "repro" is, but the code base is pretty large. I'll see if I can narrow it down. -Dave
On Mon, May 10, 2010 at 10:51 PM, David Greene <greened@obbligato.org> wrote:
On Monday 10 May 2010 21:15:42 Eric Niebler wrote:
I've been wrestling with this for days. Any ideas on how to debug this?
Nope. But it'd probably help if you sent around a self-contained repro.
I don't know what a "repro" is, but the code base is pretty large. I'll see if I can narrow it down.
Reproduction, basically minimize your code to the smallest chunk of code that represents your problem, and post it with your email as a .cpp (or a couple files or a zip if more then two or so) non-inlined attachment(s).
On Monday 10 May 2010 21:15:42 Eric Niebler wrote:
I've been wrestling with this for days. Any ideas on how to debug this?
Nope. But it'd probably help if you sent around a self-contained repro.
Ok, here's a smallish testcase. gdb shows the same problem: an invalid proto expression reference. -Dave
On Thursday 13 May 2010 23:16:31 David A. Greene wrote:
On Monday 10 May 2010 21:15:42 Eric Niebler wrote:
I've been wrestling with this for days. Any ideas on how to debug this?
Nope. But it'd probably help if you sent around a self-contained repro.
Ok, here's a smallish testcase. gdb shows the same problem: an invalid proto expression reference.
This test gives a little more information at runtime. It looks like TranslateToSymbol is called by fusion::transform but is given garbage: Building type list: comma( comma( function( terminal(int_) , terminal(32) ) , function( terminal(int_) , terminal(16) ) ) , function( terminal(int_) , terminal(64) ) ) 3 members for list Translating to symbol: function( terminal(int_) , terminal(-1208424368) ) Also, the test doesn't compile if I remove the const qualifier from the Expr argument to the two TranslateListImpl classes' call operators. I don't know why, but removing them causes a type mismatch. Maybe that's a clue? -Dave
participants (4)
-
David A. Greene
-
David Greene
-
Eric Niebler
-
OvermindDL1