tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] [PATCH 1/2] string_test: we should always use 'unsigned i


From: Kirill Smelkov
Subject: [Tinycc-devel] [PATCH 1/2] string_test: we should always use 'unsigned int' for b
Date: Sun, 18 Jan 2009 17:39:16 +0300

As recently shown in fb0ac2 (s/int/unsigned/ since GCC 4.3.2 produces
code which doesn't stop)

comparing (signed) int variable to 0x80000000 is not idea for x86_64.

This is not a good idea for x86_32 either, because GCC 4.3.2 (the one in
Debian Lenny) rightly assumes that a signed int could be never
0x80000000, and thus removes the check from

    while (b != 0x80000000) {
        ...

completely.

If we want this check, we need b to be always 'unsigned'

Signed-off-by: Kirill Smelkov <address@hidden>
---
 tcctest.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tcctest.c b/tcctest.c
index a35d25a..6e716df 100644
--- a/tcctest.c
+++ b/tcctest.c
@@ -312,11 +312,7 @@ test\14\
 
 void string_test()
 {
-#if defined(__x86_64__) && defined(__GNUC__)
     unsigned int b;
-#else
-    int b;
-#endif
     printf("string:\n");
     printf("\141\1423\143\n");/* dezdez test */
     printf("\x41\x42\x43\x3a\n");
-- 
1.6.1.79.g92b9.dirty




reply via email to

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