[gecode-users] Segfault when assigning NaryUnion

Christian Schulte cschulte at kth.se
Thu Mar 22 16:38:20 CET 2012


Hi,

You do nothing wrong, this is very definitely a bug (the problem is that
var2 is not initialized and the assignment operator crashes). I attached a
patch and we will release a new version in a few days (for other reasons,
though).

Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Jean-Noël Monette
Sent: Thursday, March 22, 2012 1:55 PM
To: users at gecode.org
Subject: [gecode-users] Segfault when assigning NaryUnion

Hello,

While writing some propagator using range iterators and testing it, I fell
upon a segfault. Tracking it down, it appears to happen when I use the
assignment operator on NaryUnion. Here is a (almost) minimal example
reproducing the problem:

#include "gecode/driver.hh"
#include "gecode/iter.hh"
using namespace Gecode;

class MySpace:public Space {
public:
     virtual Space* copy(bool share){return this;} };

int main(int argc, char* argv[]){
     MySpace home;
     Iter::Ranges::Empty empty;
     Region region(home);
     Iter::Ranges::NaryUnion var1(region,empty);
     Iter::Ranges::NaryUnion var2;
     std::cout << "pass?" << std::endl;
     var2 = var1;
     std::cout << "passed" << std::endl;
     return 0;
}


The second print statement is never reached. What am I doing wrong?

I'm using Gecode 3.7.1 (I haven't upgraded to 3.7.2 yet but according to the
changelog, this problem seems unrelated to the changes between the two
versions), on Linux Ubuntu 11.04, and compiling with GCC 4.5.2.

Thank you for your answers,

Jean-Noël Monette

_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 777 bytes
Desc: not available
URL: <http://www.gecode.org/pipermail/users/attachments/20120322/75681b0a/attachment.obj>


More information about the users mailing list