[mercury-users] List literals are falsely treated as being unique

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jan 5 22:16:35 AEDT 2009


On Mon, 5 Jan 2009, Michael Day wrote:

> Hi,
>
> Mercury will accept that the literal list [1,2,3] is unique and allow me to 
> pass it to a predicate that accepts lists with mode di.
>
> However, the list is stored as static data, in a non-writable page, so the 
> program will segfault if the list is actually modified.
>
> This is similar to the issue affecting set_char on strings.
>
> Summary: OUCH! Any program that performs destructive update on lists is only 
> one accidentally passed constant away from disaster.

Yes, we know about this one.  The CTGC system uses the approach in the 
outlined in the following diff to avoid it:
<http://www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-reviews/mercury-reviews.200801/0096.html>

Cheers,
Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list