aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji _at_ gmail.com>2009-03-15 14:50:38 +0900
committergrischka <grischka>2009-04-18 15:07:08 +0200
commit62e73da6124758c2e8c2a75defac2da092a93941 (patch)
tree98a79928bd0c2a32df7d1c24f30e44a006936464
parentae607280c5cb9746bdbcfc6916ffeb26ec0bfe8b (diff)
downloadtinycc-62e73da6124758c2e8c2a75defac2da092a93941.tar.gz
tinycc-62e73da6124758c2e8c2a75defac2da092a93941.tar.bz2
A uint64 bug fix on x86-64
64bit unsigned literal was handled as 32bit integer. Added a unittest to catch this.
-rw-r--r--tcctest.c2
-rw-r--r--x86_64-gen.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/tcctest.c b/tcctest.c
index 6e716df..050f522 100644
--- a/tcctest.c
+++ b/tcctest.c
@@ -1693,6 +1693,8 @@ void longlong_test(void)
a = 68719476720LL;
b = 4294967295LL;
printf("%d %d %d %d\n", a > b, a < b, a >= b, a <= b);
+
+ printf("%Ld\n", 0x123456789LLU);
}
void manyarg_test(void)
diff --git a/x86_64-gen.c b/x86_64-gen.c
index 2435d4d..cfaf84c 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -312,7 +312,7 @@ void load(int r, SValue *sv)
gen_modrm(r, fr, sv->sym, fc);
} else {
if (v == VT_CONST) {
- if ((ft & VT_TYPE) == VT_LLONG) {
+ if ((ft & VT_BTYPE) == VT_LLONG) {
o(0x48);
o(0xb8 + REG_VALUE(r)); /* mov $xx, r */
gen_addr64(fr, sv->sym, sv->c.ull);