[m-rev.] diff: fix bug in mercury_trace_declarative.c

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Oct 30 12:25:46 AEDT 2002


trace/mercury_trace_declarative.c:
	Fix a bug: do not follow the pointer to the caller's layout structure
	if it is null, which it will be for the top-level call to main/2.
	The goal path inside the caller of main/2 is not meaningful anyway.

Zoltan.

Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.59
diff -u -b -r1.59 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	16 Oct 2002 05:45:29 -0000	1.59
+++ trace/mercury_trace_declarative.c	28 Oct 2002 13:13:23 -0000
@@ -423,9 +423,12 @@
 	** We pass goal_path to Mercury code, which expects its type to be
 	** MR_String, not MR_ConstString, even though it treats the string as
 	** constant.
+	**
+	** return_label_layout may be NULL even if result is MR_STEP_OK, if
+	** the current event is inside the code of main/2.
 	*/
 
-	if (result == MR_STEP_OK) {
+	if (result == MR_STEP_OK && return_label_layout != NULL) {
 		goal_path = (MR_String) (MR_Integer)
 			MR_label_goal_path(return_label_layout);
 	} else {
--------------------------------------------------------------------------
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