[gecode-users] Segfault when assigning NaryUnion

Jean-Noël Monette jean-noel.monette at it.uu.se
Thu Mar 22 13:55:06 CET 2012


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



More information about the users mailing list