[gecode-users] Bug in TupleSet?

Malcolm Ryan malcolmr at cse.unsw.edu.au
Tue Dec 2 00:58:25 CET 2008


There seems to be a bug in TupleSet. If you add a particular tuple  
more than twice, the next call to extensional will segfault. Eg:

	TupleSet tuples;

	int n = 3;		// works if n <= 2

	for (int i = 0; i < n; i++) {
		IntArgs pair(2);
		pair[0] = 0;
		pair[1] = 1;

		tuples.add(pair);
	}

	TestSpace* space = new TestSpace();

	IntVarArray x(space, 2, 0, 1);
	space->add(x);

	extensional(space, x, tuples);	// segfault if n >= 3

(where TestSpace is a simple Space implementation)

GDB shows:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x0057f857 in (anonymous namespace)::FullTupleCompare::operator() ()  
at gecode/int/extensional/tuple-set.cc:55
55              if (a[i] < b[i]) {

Malcolm




More information about the gecode-users mailing list