fix bug with big octal sequences
authorMatthias Braun <matze@braunis.de>
Tue, 27 May 2008 12:50:28 +0000 (12:50 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 27 May 2008 12:50:28 +0000 (12:50 +0000)
[r19793]

ast2firm.c
parsetest/cp_error029.c

index 82914bd..b3b47dd 100644 (file)
@@ -1038,7 +1038,11 @@ static ir_node *character_constant_to_firm(const const_expression_t *cnst)
 
        long long int v = 0;
        for (size_t i = 0; i < cnst->v.character.size; ++i) {
-               v = (v << 8) | ((unsigned char)cnst->v.character.begin[i]);
+               if (char_is_signed) {
+                       v = (v << 8) | ((signed char)cnst->v.character.begin[i]);
+               } else {
+                       v = (v << 8) | ((unsigned char)cnst->v.character.begin[i]);
+               }
        }
        char    buf[128];
        size_t  len = snprintf(buf, sizeof(buf), "%lld", v);
index 0c3ead6..a7b6c2b 100644 (file)
@@ -1,4 +1,4 @@
-#include <stdio.h>
+int printf(const char *fmt, ...);
 
 int main(void)
 {