diff options
| author | 2025-10-23 09:04:36 +0200 | |
|---|---|---|
| committer | 2025-10-23 09:04:36 +0200 | |
| commit | 6149bc3a40e55ec6525aed42c9f2b2d480f20969 (patch) | |
| tree | 186854f56cb9462285f9a9b14356befd1a98871e /c/eval.c | |
| parent | 83cb10fd337546304a07caa275b2db5e93376810 (diff) | |
eval: fix indexing string literal
Diffstat (limited to 'c/eval.c')
| -rw-r--r-- | c/eval.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -93,13 +93,13 @@ unop(struct expr *ex, enum evalmode mode) assert(sub->sub[1].t == ENUMLIT && isint(sub->sub[1].ty)); off = sub->sub[1].u; p = sub->sub[0].s.p, len = sub->sub[0].s.n; - csiz = typesize(sub->sub[0].ty); + csiz = typesize(typechild(sub->sub[0].ty)); } else if (sub->t == EADD && sub->sub[1].t == ESTRLIT && eval(&sub->sub[0], EVINTCONST)) { /* 0["s"] */ assert(sub->sub[0].t == ENUMLIT && isint(sub->sub[0].ty)); off = sub->sub[0].u; p = sub->sub[1].s.p, len = sub->sub[1].s.n; - csiz = typesize(sub->sub[1].ty); + csiz = typesize(typechild(sub->sub[1].ty)); } else return 0; if (off > len) return 0; ex->t = ENUMLIT; |