summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-11-25 10:23:16 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-11-25 10:23:16 -0800
commit6395346bee2382d0e800ce28593c48ad3bab9792 (patch)
treef4f37b49b4269bc346d60bdbfe31f707c518e8e1 /eval.c
parent2ca84b85530a886bb1d5314ca5c006529e08540b (diff)
downloadtxr-6395346bee2382d0e800ce28593c48ad3bab9792.tar.gz
txr-6395346bee2382d0e800ce28593c48ad3bab9792.tar.bz2
txr-6395346bee2382d0e800ce28593c48ad3bab9792.zip
logxor: fix seriously broken function.
Reported by Guillaume le Vaillant. * arith.c (logxor): Fix broken behavior when the arguments are the same nonzero fixnum, or the same bignum object. (logxor_old): New function: verbatim copy of previous logxor. * eval.c (eval_init): Register logxor intrinsic to the broken function if compatibility is 202 or less. * txr.1: Compat note added.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 637ed8a6..0dc68559 100644
--- a/eval.c
+++ b/eval.c
@@ -6476,7 +6476,8 @@ void eval_init(void)
reg_fun(intern(lit("in"), user_package), func_n4o(in, 2));
reg_fun(intern(lit("logand"), user_package), func_n0v(logandv));
reg_fun(intern(lit("logior"), user_package), func_n0v(logiorv));
- reg_fun(intern(lit("logxor"), user_package), func_n2(logxor));
+ reg_fun(intern(lit("logxor"), user_package),
+ func_n2(if3(opt_compat && opt_compat <= 202, logxor_old, logxor)));
reg_fun(intern(lit("logtest"), user_package), func_n2(logtest));
reg_fun(intern(lit("lognot"), user_package), func_n2o(lognot, 1));
reg_fun(intern(lit("logtrunc"), user_package), func_n2(logtrunc));