Commit 584cb1fcfe

Sahnvour <sahnvour@pm.me>
2019-01-26 15:53:19
translate-c: only detect ints as negative if they are signed.
1 parent b2662e4
Changed files (1)
src/translate_c.cpp
@@ -468,7 +468,7 @@ static const char *decl_name(const Decl *decl) {
 static AstNode *trans_create_node_apint(Context *c, const llvm::APSInt &aps_int) {
     AstNode *node = trans_create_node(c, NodeTypeIntLiteral);
     node->data.int_literal.bigint = allocate<BigInt>(1);
-    bool is_negative = aps_int.isNegative(); 
+    bool is_negative = aps_int.isSigned() && aps_int.isNegative();
     if (!is_negative) {
         bigint_init_data(node->data.int_literal.bigint, aps_int.getRawData(), aps_int.getNumWords(), false);
         return node;