bug fix for infinite recursion warning

Fergus Henderson fjh at cs.mu.oz.au
Mon Feb 10 19:31:04 AEDT 1997


compiler/simplify.m:
	Fix a bug where it gave spurious "infinite recursion" warnings
	for builtin predicates.

Index: simplify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/simplify.m,v
retrieving revision 1.22
diff -u -r1.22 simplify.m
--- simplify.m	1997/02/08 16:16:01	1.22
+++ simplify.m	1997/02/10 07:27:06
@@ -353,7 +353,7 @@
 	).
 
 simplify__goal_2(Goal0, GoalInfo, Goal, GoalInfo, Info0, Info) :-
-	Goal0 = call(PredId, ProcId, Args, _, _, _),
+	Goal0 = call(PredId, ProcId, Args, IsBuiltin, _, _),
 
 	%
 	% check for calls to predicates with `pragma obsolete' declarations
@@ -386,6 +386,15 @@
 		simplify_info_get_det_info(Info1, DetInfo),
 		det_info_get_pred_id(DetInfo, PredId),
 		det_info_get_proc_id(DetInfo, ProcId),
+
+		%
+		% Don't count inline builtins.
+		% (The compiler generates code for builtins that looks
+		% recursive, so that you can take their address, but since
+		% the recursive call actually expands into inline
+		% instructions, so it's not infinite recursion.)
+		%
+		IsBuiltin \= inline_builtin,
 
 		%
 		% Are the input arguments the same (or equivalent)?

-- 
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