harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b77b8f13f13852e2a799b8fa4fc6f223dd867e20
parent 4fd4b372f4424b14a37f227adf2d6c9888fa8440
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Tue, 20 Apr 2021 18:36:27 -0400

qbe, qtype: fix type alignments

Diffstat:
Msrc/qbe.c | 8++++++++
Msrc/qtype.c | 4++--
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/qbe.c b/src/qbe.c @@ -11,36 +11,44 @@ const struct qbe_type qbe_byte = { .stype = Q_BYTE, .size = 1, + .align = 1, }, qbe_byte_s = { .stype = Q_BYTE, .size = 1, + .align = 1, .is_signed = true, }, qbe_half = { .stype = Q_HALF, .size = 2, + .align = 2, }, qbe_half_s = { .stype = Q_HALF, .size = 2, + .align = 2, .is_signed = true, }, qbe_word = { .stype = Q_WORD, .size = 4, + .align = 4, }, qbe_long = { .stype = Q_LONG, .size = 8, + .align = 8, }, qbe_single = { .stype = Q_SINGLE, .size = 4, + .align = 4, }, qbe_double = { .stype = Q_DOUBLE, .size = 8, + .align = 8, }, qbe_void = { .stype = Q__VOID, diff --git a/src/qtype.c b/src/qtype.c @@ -117,7 +117,7 @@ tagged_qtype(struct gen_context *ctx, const struct type *type) def->type.stype = Q__AGGREGATE; def->type.base = NULL; def->type.name = name; - def->type.align = SIZE_UNDEFINED; + def->type.align = type->align; def->type.is_union = true; def->type.size = type->size - type->align; @@ -178,7 +178,7 @@ lookup_aggregate(struct gen_context *ctx, const struct type *type) def->type.stype = Q__AGGREGATE; def->type.base = type; def->type.name = name; - def->type.align = SIZE_UNDEFINED; + def->type.align = type->align; def->type.size = type->size; struct qbe_field *field = &def->type.fields;