fix vm_fmtPoint on non-equal s and src types

This commit is contained in:
dzaima 2021-08-21 04:41:51 +03:00
parent 167351bdba
commit a56a20b046
3 changed files with 8 additions and 2 deletions

View File

@ -591,4 +591,8 @@ NOINLINE void printAllocStats() {
}
return x;
}
NOINLINE NORETURN void assert_fail(char* expr, char* file, int line, const char fn[]) {
printf("%s:%d: %s: Assertion `%s` failed.\n", file, line, fn, expr);
err("");
}
#endif

View File

@ -207,7 +207,8 @@ typedef struct Arr {
} Arr;
#ifdef DEBUG
#include<assert.h>
NOINLINE NORETURN void assert_fail(char* expr, char* file, int line, const char fn[]);
#define assert(X) do { if (!(X)) assert_fail(#X, __FILE__, __LINE__, __PRETTY_FUNCTION__); } while (0)
B VALIDATE(B x);
Value* VALIDATEP(Value* x);
#define UD assert(false);

View File

@ -998,7 +998,8 @@ NOINLINE B vm_fmtPoint(B src, B prepend, B path, usz cs, usz ce) { // consumes p
else AFMT("at ");
i64 padEnd = (i64)a(s)->ia;
i64 padStart = padEnd;
while (padStart>0 && o2cu(srcGetU(s,padStart-1))!='\n') padStart--;
BS2B sGetU = TI(s,getU);
while (padStart>0 && o2cu(sGetU(s,padStart-1))!='\n') padStart--;
Arr* slice = TI(src,slice)(inc(src),srcS, srcE-srcS); arr_shVec(slice);
AJOIN(taga(slice));