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.
This commit is contained in:
Jan Nieuwenhuizen 2017-03-25 19:03:03 +01:00
parent c39c04cb56
commit f015150cd8
3 changed files with 3 additions and 10 deletions

View file

@ -860,7 +860,7 @@
(list (lambda (f g ta t d) (list (lambda (f g ta t d)
(i386:value->accu 0))) (i386:value->accu 0)))
(list (lambda (f g ta t d) (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 (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) ((cast ,cast ,o)

View file

@ -1275,14 +1275,7 @@ ash (SCM n, SCM count)
assert (TYPE (count) == TNUMBER); assert (TYPE (count) == TNUMBER);
int cn = VALUE (n); int cn = VALUE (n);
int ccount = VALUE (count); int ccount = VALUE (count);
#if __GNUC__
return MAKE_NUMBER ((ccount < 0) ? cn >> -ccount : cn << ccount); 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] // Lib [rest of]

View file

@ -230,10 +230,10 @@ math_test ()
i = -3; i = -3;
puts ("t: -i\n"); puts ("t: -i\n");
if (-i != 3) return -i; if (-i != 3) return 1;
puts ("t: -1 + 2\n"); puts ("t: -1 + 2\n");
if (-1 + 2 != 1) return -1 + 2; if (-1 + 2 != 1) return 1;
return read_test (); return read_test ();
} }