~ chicken-core (chicken-5) 90ff06e528de6fadc9128baeb71a2837fd63fc41


commit 90ff06e528de6fadc9128baeb71a2837fd63fc41
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sun May 16 00:04:28 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sun May 16 00:04:46 2010 +0200

    added missing argument checks for inline number comparison operators (thanks to Jim Ursetto)

diff --git a/runtime.c b/runtime.c
index 65e3960a..0807d804 100644
--- a/runtime.c
+++ b/runtime.c
@@ -6388,15 +6388,16 @@ C_regparm C_word C_fcall C_i_nequalp(C_word x, C_word y)
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool((double)C_unfix(x) == C_flonum_magnitude(y));
 
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "=", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "=", y);
   }
   else if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
     if(y & C_FIXNUM_BIT) return C_mk_bool(C_flonum_magnitude(x) == (double)C_unfix(y));
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool(C_flonum_magnitude(x) == C_flonum_magnitude(y));
     
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "=", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "=", y);
   }
+  else barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "=", x);
 
   return C_SCHEME_FALSE;
 }
@@ -6468,15 +6469,16 @@ C_regparm C_word C_fcall C_i_greaterp(C_word x, C_word y)
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool((double)C_unfix(x) > C_flonum_magnitude(y));
 
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, ">", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, ">", y);
   }
   else if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
     if(y & C_FIXNUM_BIT) return C_mk_bool(C_flonum_magnitude(x) > (double)C_unfix(y));
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool(C_flonum_magnitude(x) > C_flonum_magnitude(y));
     
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, ">", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, ">", y);
   }
+  else barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, ">", x);
 
   return C_SCHEME_FALSE;
 }
@@ -6548,15 +6550,16 @@ C_regparm C_word C_fcall C_i_lessp(C_word x, C_word y)
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool((double)C_unfix(x) < C_flonum_magnitude(y));
 
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "<", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "<", y);
   }
   else if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
     if(y & C_FIXNUM_BIT) return C_mk_bool(C_flonum_magnitude(x) < (double)C_unfix(y));
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool(C_flonum_magnitude(x) < C_flonum_magnitude(y));
     
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "<", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "<", y);
   }
+  else barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "<", x);
 
   return C_SCHEME_FALSE;
 }
@@ -6628,15 +6631,16 @@ C_regparm C_word C_fcall C_i_greater_or_equalp(C_word x, C_word y)
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool((double)C_unfix(x) >= C_flonum_magnitude(y));
 
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, ">=", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, ">=", y);
   }
   else if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
     if(y & C_FIXNUM_BIT) return C_mk_bool(C_flonum_magnitude(x) >= (double)C_unfix(y));
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool(C_flonum_magnitude(x) >= C_flonum_magnitude(y));
     
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, ">=", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, ">=", y);
   }
+  else barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, ">=", x);
 
   return C_SCHEME_FALSE;
 }
@@ -6708,15 +6712,16 @@ C_regparm C_word C_fcall C_i_less_or_equalp(C_word x, C_word y)
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool((double)C_unfix(x) <= C_flonum_magnitude(y));
 
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "<=", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "<=", y);
   }
   else if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
     if(y & C_FIXNUM_BIT) return C_mk_bool(C_flonum_magnitude(x) <= (double)C_unfix(y));
     else if(!C_immediatep(y) && C_block_header(y) == C_FLONUM_TAG)
       return C_mk_bool(C_flonum_magnitude(x) <= C_flonum_magnitude(y));
     
-    barf(C_BAD_ARGUMENT_TYPE_ERROR, "<=", y);
+    barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "<=", y);
   }
+  else barf(C_BAD_ARGUMENT_TYPE_NO_NUMBER_ERROR, "<=", x);
 
   return C_SCHEME_FALSE;
 }
Trap