| ... | @@ -3038,7 +3038,7 @@ void init_const_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *str) { | ... | @@ -3038,7 +3038,7 @@ void init_const_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *str) { |
| 3038 | ConstExprValue *this_char = &const_val->data.x_array.elements[i]; | 3038 | ConstExprValue *this_char = &const_val->data.x_array.elements[i]; |
| 3039 | this_char->special = ConstValSpecialStatic; | 3039 | this_char->special = ConstValSpecialStatic; |
| 3040 | this_char->type = g->builtin_types.entry_u8; | 3040 | this_char->type = g->builtin_types.entry_u8; |
| 3041 | bignum_init_unsigned(&this_char->data.x_bignum, buf_ptr(str)[i]); | 3041 | bignum_init_unsigned(&this_char->data.x_bignum, (uint8_t)buf_ptr(str)[i]); |
| 3042 | } | 3042 | } |
| 3043 | } | 3043 | } |
| 3044 | | 3044 | |
| ... | @@ -3059,7 +3059,7 @@ void init_const_c_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *str) { | ... | @@ -3059,7 +3059,7 @@ void init_const_c_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *str) { |
| 3059 | ConstExprValue *this_char = &array_val->data.x_array.elements[i]; | 3059 | ConstExprValue *this_char = &array_val->data.x_array.elements[i]; |
| 3060 | this_char->special = ConstValSpecialStatic; | 3060 | this_char->special = ConstValSpecialStatic; |
| 3061 | this_char->type = g->builtin_types.entry_u8; | 3061 | this_char->type = g->builtin_types.entry_u8; |
| 3062 | bignum_init_unsigned(&this_char->data.x_bignum, buf_ptr(str)[i]); | 3062 | bignum_init_unsigned(&this_char->data.x_bignum, (uint8_t)buf_ptr(str)[i]); |
| 3063 | } | 3063 | } |
| 3064 | ConstExprValue *null_char = &array_val->data.x_array.elements[len_with_null - 1]; | 3064 | ConstExprValue *null_char = &array_val->data.x_array.elements[len_with_null - 1]; |
| 3065 | null_char->special = ConstValSpecialStatic; | 3065 | null_char->special = ConstValSpecialStatic; |
| ... | @@ -3594,11 +3594,13 @@ void render_const_value(Buf *buf, ConstExprValue *const_val) { | ... | @@ -3594,11 +3594,13 @@ void render_const_value(Buf *buf, ConstExprValue *const_val) { |
| 3594 | buf_append_char(buf, '"'); | 3594 | buf_append_char(buf, '"'); |
| 3595 | for (uint64_t i = 0; i < len; i += 1) { | 3595 | for (uint64_t i = 0; i < len; i += 1) { |
| 3596 | ConstExprValue *child_value = &const_val->data.x_array.elements[i]; | 3596 | ConstExprValue *child_value = &const_val->data.x_array.elements[i]; |
| 3597 | uint64_t x = child_value->data.x_bignum.data.x_uint; | 3597 | uint64_t big_c = child_value->data.x_bignum.data.x_uint; |
| 3598 | if (x == '"') { | 3598 | assert(big_c <= UINT8_MAX); |
| | 3599 | uint8_t c = big_c; |
| | 3600 | if (c == '"') { |
| 3599 | buf_append_str(buf, "\\\""); | 3601 | buf_append_str(buf, "\\\""); |
| 3600 | } else { | 3602 | } else { |
| 3601 | buf_append_char(buf, x); | 3603 | buf_append_char(buf, c); |
| 3602 | } | 3604 | } |
| 3603 | } | 3605 | } |
| 3604 | buf_append_char(buf, '"'); | 3606 | buf_append_char(buf, '"'); |