tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] How do I push unsigned with vpushi()?


From: Rob Landley
Subject: [Tinycc-devel] How do I push unsigned with vpushi()?
Date: Wed, 21 Feb 2007 13:15:20 -0500
User-agent: KMail/1.9.1

So I stumbled across

  http://en.wikipedia.org/wiki/Tiny_C_Compiler

and it pointed me to some patches to integrate into my mercurial repository

  http://landley.net/hg/tinycc

and at least one major outstanding bug report, I.E.

  http://osvdb.org/displayvuln.php?osvdb_id=22956

So I think I've narrowed it down to case TOK_SIZEOF: in function unary() in 
tcc.c, and it's doing a vpushi(value).  It's pushing a signed integer, and it 
should be pushing an unsigned integer, and I dunno how to do that.  Best I 
can figure out how to do is to patch the type after the push, I.E.

--- a/tcc.c     Mon Jan 22 13:18:11 2007 -0500
+++ b/tcc.c     Wed Feb 21 12:56:35 2007 -0500
@@ -7351,6 +7351,7 @@ static void unary(void)
         } else {
             vpushi(align);
         }
+        vtop->type.t |= VT_UNSIGNED;
         break;

     case TOK_builtin_types_compatible_p:

I also noticed that if you build my current tree's tcc with gcc, "make test" 
is ok.  But if you rebuild it with itself, one test gets the wrong answer.  
Have to poke at this a bit later...

Rob
-- 
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery




reply via email to

[Prev in Thread] Current Thread [Next in Thread]