[gecode-users] Bug in TupleSet?

Mikael Zayenz Lagerkvist zayenz at gmail.com
Wed Dec 3 07:37:05 CET 2008


A TupleSet does not accept more than one instance of a tuple (hence
the name set). However, the implementation should probably be safer
for erroneous usage and throw an exception during finalization if
multiple tuples are discovered.

Cheers,
Mikael

On Tue, Dec 2, 2008 at 12:58 AM, Malcolm Ryan <malcolmr at cse.unsw.edu.au> wrote:
> 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
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>



-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list