From 136a4d4a67ee5b1cd8411a5dfa03eee685be345e Mon Sep 17 00:00:00 2001 From: vsc Date: Fri, 8 Jun 2001 19:33:16 +0000 Subject: [PATCH] fix divide by zero error on debugging message if trail was empty git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@71 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/heapgc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C/heapgc.c b/C/heapgc.c index c6bd15417..d2fbd8b51 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -1851,11 +1851,12 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR) } new_TR = dest; if (is_gc_verbose()) { - YP_fprintf(YP_stderr, - "[GC] Trail: discarded %d (%ld%%) cells out of %ld\n", - discard_trail_entries, - (unsigned long int)(discard_trail_entries*100/(old_TR-(tr_fr_ptr)TrailBase)), - (unsigned long int)(old_TR-(tr_fr_ptr)TrailBase)); + if (old_TR != (tr_fr_ptr)TrailBase) + YP_fprintf(YP_stderr, + "[GC] Trail: discarded %d (%ld%%) cells out of %ld\n", + discard_trail_entries, + (unsigned long int)(discard_trail_entries*100/(old_TR-(tr_fr_ptr)TrailBase)), + (unsigned long int)(old_TR-(tr_fr_ptr)TrailBase)); #ifdef DEBUG if (hp_entrs > 0) YP_fprintf(YP_stderr,