Fix another unsafe optimization of unsafe-fxmodulo.

Found using random testing.
This commit is contained in:
Vincent St-Amour 2013-04-02 13:40:04 -04:00
parent f66ee7088f
commit 8948388ec5
2 changed files with 2 additions and 1 deletions

View File

@ -92,6 +92,7 @@
(test-bin 0 'unsafe-fxmodulo 0 -5) (test-bin 0 'unsafe-fxmodulo 0 -5)
(test-bin 0 'unsafe-fxmodulo 10 1) (test-bin 0 'unsafe-fxmodulo 10 1)
(err/rt-test (unsafe-fxmodulo (error "bad") 1) exn:fail?) ; not 0 (err/rt-test (unsafe-fxmodulo (error "bad") 1) exn:fail?) ; not 0
(err/rt-test (unsafe-fxmodulo 0 (error "bad")) exn:fail?) ; not 0
(test-bin 3.4 'unsafe-fl+ 1.4 2.0) (test-bin 3.4 'unsafe-fl+ 1.4 2.0)
(test-bin -1.1 'unsafe-fl+ 1.0 -2.1) (test-bin -1.1 'unsafe-fl+ 1.0 -2.1)

View File

@ -2642,7 +2642,7 @@ static Scheme_Object *finish_optimize_application3(Scheme_App3_Rec *app, Optimiz
return app->rand1; return app->rand1;
} else if (IS_NAMED_PRIM(app->rator, "unsafe-fxremainder") } else if (IS_NAMED_PRIM(app->rator, "unsafe-fxremainder")
|| IS_NAMED_PRIM(app->rator, "unsafe-fxmodulo")) { || IS_NAMED_PRIM(app->rator, "unsafe-fxmodulo")) {
if (z1) if (z1 && scheme_omittable_expr(app->rand2, 1, 20, 0, info, NULL, -1, 0))
return scheme_make_integer(0); return scheme_make_integer(0);
if (SAME_OBJ(app->rand2, scheme_make_integer(1)) if (SAME_OBJ(app->rand2, scheme_make_integer(1))
&& scheme_omittable_expr(app->rand1, 1, 20, 0, info, NULL, -1, 0)) && scheme_omittable_expr(app->rand1, 1, 20, 0, info, NULL, -1, 0))