From f015150cd86a345fa65b972d81460f2339c954ad Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 25 Mar 2017 19:03:03 +0100 Subject: [PATCH] mescc: Bugfix for neg. * module/language/c99/compiler.mes (expr->accu): Fix neg. * scaffold/t.c (math_test): Test it. * scaffold/mini-mes.c (ash): Remove workaround. --- module/language/c99/compiler.mes | 2 +- scaffold/mini-mes.c | 7 ------- scaffold/t.c | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index d22bd351..382058f7 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -860,7 +860,7 @@ (list (lambda (f g ta t d) (i386:value->accu 0))) (list (lambda (f g ta t d) - (i386:base-sub)))))) + (i386:sub-base)))))) ;;((cast (type-name (decl-spec-list (type-spec (typename "SCM"))) (abs-declr (declr-fctn (declr-scope (abs-declr (pointer))) (param-list (param-decl (decl-spec-list (type-spec (typename "SCM")))))))) (d-sel (ident "function") (array-ref (d-sel (ident "cdr") (array-ref (p-expr (ident "fn")) (p-expr (ident "g_cells")))) (p-expr (ident "functions")))))) ((cast ,cast ,o) diff --git a/scaffold/mini-mes.c b/scaffold/mini-mes.c index 9032fe8f..33bf34f8 100644 --- a/scaffold/mini-mes.c +++ b/scaffold/mini-mes.c @@ -1275,14 +1275,7 @@ ash (SCM n, SCM count) assert (TYPE (count) == TNUMBER); int cn = VALUE (n); int ccount = VALUE (count); -#if __GNUC__ return MAKE_NUMBER ((ccount < 0) ? cn >> -ccount : cn << ccount); -#else - int x; - if (ccount < 0) x = cn >> INT_MIN - ccount; - else x = cn << ccount; - return MAKE_NUMBER (x); -#endif } // Lib [rest of] diff --git a/scaffold/t.c b/scaffold/t.c index 459c6178..d88672dc 100644 --- a/scaffold/t.c +++ b/scaffold/t.c @@ -230,10 +230,10 @@ math_test () i = -3; puts ("t: -i\n"); - if (-i != 3) return -i; + if (-i != 3) return 1; puts ("t: -1 + 2\n"); - if (-1 + 2 != 1) return -1 + 2; + if (-1 + 2 != 1) return 1; return read_test (); }