harec

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

commit 5cd989b97697ecd43994d77480a29a3e456890f4
parent be1498a04af7950f84dbe39e253cba50e6fe5555
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed,  4 Aug 2021 14:01:25 +0200

gen: fix string internal data structure

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Msrc/gen.c | 4++--
Mtests/rt.c | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -445,11 +445,11 @@ gen_const_string_at(struct gen_context *ctx, struct qbe_value strp = mkcopy(ctx, &out, ".%d"); struct qbe_value qlen = constl(len); struct qbe_value offs = constl(builtin_type_size.size); - pushi(ctx->current, NULL, store, &qlen, &strp, NULL); + pushi(ctx->current, NULL, store, &global, &strp, NULL); pushi(ctx->current, &strp, Q_ADD, &strp, &offs, NULL); pushi(ctx->current, NULL, store, &qlen, &strp, NULL); pushi(ctx->current, &strp, Q_ADD, &strp, &offs, NULL); - pushi(ctx->current, NULL, store, &global, &strp, NULL); + pushi(ctx->current, NULL, store, &qlen, &strp, NULL); } static void diff --git a/tests/rt.c b/tests/rt.c @@ -11,8 +11,8 @@ void *c_memcpy(void *dest, const void *src, size_t n) { } struct ha_str { - size_t len, cap; char *str; + size_t len, cap; }; void c_abort(struct ha_str str) {