diff: term_errors.m bug fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Jan 25 01:08:13 AEDT 1998


On 25-Jan-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 24-Jan-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Estimated hours taken: 0.5
> > 
> > compiler/term_errors.m:
> > 	Fix some bugs:
> > 	- when printing out the mode number, it needs
> > 	  to take it mod 10000 to strip off the "priority".
> > 	- In some cases, termination analysis infers that a procedure
> > 	  can loop, but the list of reasons why is empty.
> > 	  This should never happen, and so term_errors.m was calling
> > 	  error/1 in this situation, but in practice it does happen,
> > 	  so I've changed term_errors.m to print out an error message
> > 	  with "for unknown reason(s)" in that case.
> > 	  We still ought to fix the problem, but this change at least
> > 	  makes it easier to track down, since the error message says
> > 	  which procedure the problem is occuring for.
> 
> You forgot the diff again.

Oops.  Here it is.
(Note that the change to add the "mod 10000" code was actually
undone by my later change to delete that hack entirely.)

Index: term_errors.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_errors.m,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- term_errors.m	1998/01/23 12:56:56	1.6
+++ term_errors.m	1998/01/23 17:05:34	1.7
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1997 The University of Melbourne.
+% Copyright (C) 1997-1998 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -157,7 +157,13 @@
 	),
 	(
 		{ Errors = [] },
-		{ error("empty list of errors") }
+		% XXX this should never happen
+		% XXX but for some reason, it often does
+		% { error("empty list of errors") }
+		{ Pieces2 = ["not", "proven,", "for", "unknown",
+			"reason(s)."] },
+		{ list__append(Pieces1, Pieces2, Pieces) },
+		write_error_pieces(Context, 0, Pieces)
 	;
 		{ Errors = [Error] },
 		{ Pieces2 = ["not", "proven", "for", "the",
@@ -505,7 +511,9 @@
 
 term_errors__describe_one_proc_name(proc(PredId, ProcId), Module, Piece) :-
 	term_errors__describe_one_pred_name(PredId, Module, PredPiece),
-	proc_id_to_int(ProcId, ProcIdInt),
+	proc_id_to_int(ProcId, ProcIdInt0),
+	% strip off the "priority"
+	ProcIdInt is ProcIdInt0 mod 10000,
 	string__int_to_string(ProcIdInt, ProcIdPart),
 	string__append_list([
 		PredPiece,
-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list