mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix alignment.
This commit is contained in:
@@ -4722,7 +4722,7 @@ static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr)
|
|||||||
case CONST_STRING:
|
case CONST_STRING:
|
||||||
{
|
{
|
||||||
Type *str_type = type_lowering(expr->type);
|
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))
|
if (is_array && llvm_is_global_eval(c))
|
||||||
{
|
{
|
||||||
// In the global alloc case, create the byte array.
|
// 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);
|
LLVMSetInitializer(global_name, data);
|
||||||
if (is_array)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user