Fix alignment.

This commit is contained in:
Christoffer Lerno
2025-08-01 10:55:04 +02:00
parent 61a21203f4
commit 2c6ff00261

View File

@@ -4722,7 +4722,7 @@ static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr)
case CONST_STRING:
{
Type *str_type = type_lowering(expr->type);
bool is_array = str_type->type_kind == TYPE_ARRAY || str_type->type_kind == TYPE_VECTOR;
bool is_array = str_type->type_kind == TYPE_ARRAY || (str_type->type_kind == TYPE_VECTOR && type_size(type->array.base) == 1);
if (is_array && llvm_is_global_eval(c))
{
// In the global alloc case, create the byte array.
@@ -4776,7 +4776,7 @@ static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr)
LLVMSetInitializer(global_name, data);
if (is_array)
{
llvm_value_set_address(c, be_value, global_name, type, type_alloca_alignment(expr->type));
llvm_value_set_address(c, be_value, global_name, type, 1);
}
else
{