[m-rev.] for review 4/4: Fix regtest
Zoltan Somogyi
zoltan.somogyi at runbox.com
Fri Mar 17 15:04:48 AEDT 2023
2023-03-17 14:21 GMT+11:00 "Paul Bone" <paul at bone.id.au>:
> --- a/runtime/machdeps/regtest.c
> +++ b/runtime/machdeps/regtest.c
> @@ -68,10 +68,14 @@ do { \
> fprintf(f, "Hello, world %d\n", i); \
> x = sin(x); \
> x = pow(x,1.5); \
> - malloc(100); \
> + if (!malloc(100)) { \
> + abort(); \
> + } \
> call_func_with_args(1,2,3,4,5,6,7,8,10.0,20.0,30.0,40.0); \
> extern_call_func_with_args(1,2,3,4,5,6,7,8,10.0,20.0,30.0,40.0); \
> - system("/bin/true"); \
> + if (system("/bin/true")) { \
> + abort(); \
> + } \
> } while (0)
I would prefer the conditions to compare explicitly against zero,
as in "if (malloc(100) == NULL)" and "if (system(...) != 0)",
both here and in regtest2.c.
Apart from that, all four parts seem fine. I think it is likely that
using more callee-save registers would help performance,
but testing this requires access to a RISC-V machine, which
I don't have.
Zoltan.
More information about the reviews
mailing list