[m-rev.] diff: remove destructive update modes of string__set_char

Simon Taylor stayl at cs.mu.OZ.AU
Fri Oct 26 17:29:38 AEST 2001


On 26-Oct-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 26-Oct-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > 
> > Estimated hours taken: 0.25
> > Branches: main, release
> > 
> > NEWS:
> > library/string.m:
> > 	Remove the buggy destructive update modes of string__set_char,
> > 	string__set_char_det and string__unsafe_set_char (they cause
> > 	crashes when applied to constant strings).
> 
> These modes are not buggy.  The bug is storing strings or other data
> structures in read-only memory when they are passed to procedures with
> mode `di'.

I'll change the NEWS file entry. The chances of this being fixed
properly any time soon aren't good.

Simon.

Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.221
diff -u -u -r1.221 NEWS
--- NEWS	26 Oct 2001 06:52:10 -0000	1.221
+++ NEWS	26 Oct 2001 07:28:13 -0000
@@ -55,9 +55,12 @@
   float.m and extras/complex_numbers (because of rounding errors the
   functions aren't actually reversible).
 
-* We've removed the buggy destructive update modes of string__set_char,
-  string__set_char_det and string__unsafe_set_char (they cause crashes when
-  applied to constant strings).
+* We've removed the destructive update modes of string__set_char,
+  string__set_char_det and string__unsafe_set_char. The compiler
+  currently always stores constant strings in static data, even
+  if they are passed to procedures with mode `di', so any attempt
+  to update a constant string will cause a crash. Fixing this properly
+  will be a lot of work, so for now we have just removed the modes.
  
 * The exception module has a new predicate `try_store', which is
   like `try_io', but which works with stores rather than io__states.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list