From 8ca98e23c4e54b1552c819425890584e6357f46a Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 6 Mar 2017 21:45:41 +0100 Subject: Tidy unary() a bit factor code a bit for transforming tokens into SValues. This revealed a bug in TOK_GET (see testcase), which happened to be harmless before. So fix that as well. --- tccpp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tccpp.c') diff --git a/tccpp.c b/tccpp.c index 1f3b083..4cf0ef5 100644 --- a/tccpp.c +++ b/tccpp.c @@ -1230,10 +1230,13 @@ static inline void TOK_GET(int *t, const int **pp, CValue *cv) case TOK_CUINT: case TOK_CCHAR: case TOK_LCHAR: - case TOK_CFLOAT: case TOK_LINENUM: tab[0] = *p++; + cv->i = (*t == TOK_CUINT) ? (unsigned)cv->i : (int)cv->i; break; + case TOK_CFLOAT: + tab[0] = *p++; + break; case TOK_STR: case TOK_LSTR: case TOK_PPNUM: -- cgit v1.3.1