[gecode-users] Bug in TupleSet?
Christian Schulte
cschulte at kth.se
Thu Dec 4 22:53:38 CET 2008
I second Malcolm here.
Christian
--
Christian Schulte, www.it.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Malcolm Ryan
Sent: Thursday, December 04, 2008 9:58 PM
To: gecode list
Subject: Re: [gecode-users] Bug in TupleSet?
Why not just make adding the duplicate elements to be without effect?
That's what most set implementations I've encountered do.
Malcolm
On 03/12/2008, at 5:37 PM, Mikael Zayenz Lagerkvist wrote:
> 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/
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list