harec

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

commit 6962cf55dee6c2d7bc094319bced99709bac0d27
parent 986a745e06f5ba2112e447f069317f8c2c3429a5
Author: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Date:   Sat, 27 Mar 2021 14:36:45 +0100

gen: Cast constants to uint64_t for 64-bit data items

Global arrays with 64-bit integers would only have the 32 least
significant bits emitted in the data items. A declaration like:

	const _K: [_]u64 = [0x428a2f98d728ae22];

would result in:

	data section ".data._K" $_K = { l 3609767458 }

where it should have been 4794697086780616226.

The fix was suggested by Armin Weigl.

Diffstat:
Msrc/gen.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gen.c b/src/gen.c @@ -2703,7 +2703,7 @@ gen_data_item(struct gen_context *ctx, struct expression *expr, case STORAGE_I64: case STORAGE_SIZE: item->type = QD_VALUE; - constl(&item->value, (uint32_t)constant->uval); + constl(&item->value, (uint64_t)constant->uval); break; case STORAGE_F32: case STORAGE_F64: