scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit c3ea36274bc6d11ed47c11275e3c8bb64291c101
parent 53727b8e75d92fb88ac9916608e581e181d832c6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  7 Oct 2015 14:00:48 +0200

Force to use long long in emitconst

We don't know what is the size of the constant, so the
best option is to cast it to long long and use the
specifier for it.

Diffstat:
cc1/code.c | 4+++-
cc1/tests/test024.c | 12++++++------
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/cc1/code.c b/cc1/code.c @@ -195,7 +195,9 @@ emitconst(Node *np) case INT: case ENUM: u = (tp->sign) ? (TUINT) sym->u.i : sym->u.u; - printf("#%c%lX", np->type->letter, sym->u.i & ones(tp->size)); + printf("#%c%llX", + np->type->letter, + (long long) sym->u.i & ones(tp->size)); break; case ARY: /* diff --git a/cc1/tests/test024.c b/cc1/tests/test024.c @@ -11,17 +11,17 @@ G2 F1 main A3 Q i A4 O u A3 #Q1 :Q - A3 #QFFFFFFFF :Q - A3 #QFFFFFFFF :Q + A3 #QFFFFFFFFFFFFFFFF :Q + A3 #QFFFFFFFFFFFFFFFF :Q A3 #QFFFF :Q - A3 #QFFFFFFFF :Q + A3 #QFFFFFFFFFFFFFFFF :Q A3 #Q3 :Q A3 #Q1 :Q A4 #O1 :O - A4 #OFFFFFFFF :O - A4 #OFFFFFFFF :O + A4 #OFFFFFFFFFFFFFFFF :O + A4 #OFFFFFFFFFFFFFFFF :O A4 #OFFFF :O - A4 #OFFFFFFFF :O + A4 #OFFFFFFFFFFFFFFFF :O A4 #O3 :O A4 #O0 :O r #I0