diff: partial fix for seg fault

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 2 20:45:54 AEDT 1999


Estimated hours taken: 0.2

runtime/mercury_deep_copy_body.h:
	Change the buggy code for copying closures to instead
	call `fatal_error("sorry, not implemented: ...");',
	rather than giving a segmentation violation (or worse).

Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_deep_copy_body.h
--- mercury_deep_copy_body.h	1999/02/23 09:42:25	1.4
+++ mercury_deep_copy_body.h	1999/03/02 09:35:28
@@ -202,6 +202,14 @@
                 /* copy pointer to code for closure */
                 new_closure[1] = data_value[1];
 
+#if 0		
+		/*
+		** XXX THIS IS WRONG.  We don't have any information
+		** about the types of the things in closures.
+		** The pred type only tells us about the arguments
+		** which have not yet been applied, not the ones
+		** in the closure.
+		*/
                 /* copy arguments */
                 for (i = 0; i < args; i++) {
                     new_closure[i + 2] = copy(&data_value[i + 2],
@@ -209,6 +217,9 @@
                         type_info[i + TYPEINFO_OFFSET_FOR_PRED_ARGS],
                         lower_limit, upper_limit);
                 }
+#else
+		fatal_error("sorry, not implemented: cannot copy closure");
+#endif
                 new_data = (Word) new_closure;
                 leave_forwarding_pointer(data_ptr, new_data);
             } else {

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh at 128.250.37.3        |     -- leaked Microsoft memo.



More information about the developers mailing list