[hackers] [scc] Force to use long long in emitconst || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 7 Oct 2015 17:44:48 +0200 (CEST)

commit c3ea36274bc6d11ed47c11275e3c8bb64291c101
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Oct 7 14:00:48 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Oct 7 17:23:30 2015 +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.

diff --git a/cc1/code.c b/cc1/code.c
index 76a7dcf..c1b021c 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -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
index a4df3a1..11a2fb4 100644
--- a/cc1/tests/test024.c
+++ b/cc1/tests/test024.c
_AT_@ -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
Received on Wed Oct 07 2015 - 17:44:48 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 07 2015 - 17:48:26 CEST