diff options
Diffstat (limited to 'gcc/gcc/elna-tree.cc')
| -rw-r--r-- | gcc/gcc/elna-tree.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/gcc/elna-tree.cc b/gcc/gcc/elna-tree.cc index 255cf60..5284e42 100644 --- a/gcc/gcc/elna-tree.cc +++ b/gcc/gcc/elna-tree.cc @@ -288,9 +288,9 @@ namespace elna::gcc { return std::get<bool>(constant_value) ? boolean_true_node : boolean_false_node; } - else if (std::holds_alternative<unsigned char>(constant_value)) + else if (std::holds_alternative<std::uint32_t>(constant_value)) { - return build_int_cstu(elna_char_type_node, std::get<unsigned char>(constant_value)); + return build_int_cstu(elna_char_type_node, std::get<std::uint32_t>(constant_value)); } else if (std::holds_alternative<std::nullptr_t>(constant_value)) { @@ -300,7 +300,11 @@ namespace elna::gcc { const auto& string_value = std::get<std::string>(constant_value); tree index_constant = build_int_cstu(elna_word_type_node, string_value.size()); - tree char_array_type = build_array_type(elna_char_type_node, build_index_type(index_constant)); + + tree ptr_field = TYPE_FIELDS(type); + tree ptr_type = TREE_TYPE(ptr_field); + tree element_type = TYPE_MAIN_VARIANT(TREE_TYPE(ptr_type)); + tree char_array_type = build_array_type(element_type, build_index_type(index_constant)); tree string_literal = build_string(string_value.size(), string_value.c_str()); TREE_TYPE(string_literal) = char_array_type; @@ -308,10 +312,7 @@ namespace elna::gcc TREE_READONLY(string_literal) = 1; TREE_STATIC(string_literal) = 1; - tree ptr_field = TYPE_FIELDS(type); - - tree ptr_type = TREE_TYPE(ptr_field); - string_literal = build4(ARRAY_REF, elna_char_type_node, + string_literal = build4(ARRAY_REF, element_type, string_literal, integer_zero_node, NULL_TREE, NULL_TREE); string_literal = build1(ADDR_EXPR, ptr_type, string_literal); |
