From Alexey Yerin to ~sircmpwn/hare-dev
Type aliases in Hare currently have two separate uses: 1. To give a name to an existing type for clarity, for example, name a function type to avoid writing out the signature every time. In this case, no distinct type should be created. 2. To create a new distinct type with the same storage as the underlying type. This is used for void aliases, structs, enums, etc. These types carry a semantic meaning or an invariant (e.g. that an `io::file` must be a valid file descriptor on Unix-like systems). Hare conflates those two cases which can lead to unintuitive behaviour. For example, consider two snippets:
From Alexey Yerin to ~sircmpwn/public-inbox
--disable-nlp causes the build to fail for mysterious reasons. This option is also not documented anywhere so it was probably meant to be --disable-nls like in binutils. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fef412a..cee1db7e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ And GCC: --with-sysroot=$sysroot \ --enable-languages=c,c++ \ [message trimmed]
From Alexey Yerin to ~mpu/qbe
On Fri Aug 2, 2024 at 14:22 +0200, Lorenz (xha) wrote: > On Fri, Aug 02, 2024 at 02:39:07PM +0300, Alexey Yerin wrote: > > Clang incorrectly optimizes this negation with -O2 and causes QBE to > > sorry, but what does clang have to do with QBE? :D If QBE is compiled with clang -O2, clang compiles (n = -n) with the assumption that signed overflow doesn't happen. It happens to be correct for all n except INT64_MIN, which is turned into 0. All this culminates in QBE generating incorrect immediates in assembly. This issue is only present if QBE is compiled using clang with -O2 or higher, and doesn't happen when a different compiler is used.
From Alexey Yerin to ~mpu/qbe
Clang incorrectly optimizes this negation with -O2 and causes QBE to emit 0 in place of INT64_MIN. --- arm64/isel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm64/isel.c b/arm64/isel.c index 062beb3..9ce6adc 100644 --- a/arm64/isel.c +++ b/arm64/isel.c @@ -24,7 +24,7 @@ imm(Con *c, int k, int64_t *pn) i = Iplo12; if (n < 0) { i = Inlo12; [message trimmed]
From Alexey Yerin to ~sircmpwn/hare-dev
Signed-off-by: Alexey Yerin <yyp@disroot.org> --- v1 -> v2: Add missing terminating NULL to variadic pushi src/check.c | 6 +++++- src/gen.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/check.c b/src/check.c index f51b0de..5c7be5b 100644 --- a/src/check.c +++ b/src/check.c @@ -1469,7 +1469,11 @@ check_expr_call(struct context *ctx, *arg->value = (struct expression){ [message trimmed]
From Alexey Yerin to ~sircmpwn/hare-dev
Signed-off-by: Alexey Yerin <yyp@disroot.org> --- src/check.c | 6 +++++- src/gen.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/check.c b/src/check.c index f51b0de..5c7be5b 100644 --- a/src/check.c +++ b/src/check.c @@ -1469,7 +1469,11 @@ check_expr_call(struct context *ctx, *arg->value = (struct expression){ .type = EXPR_LITERAL, .result = param->type, [message trimmed]
From Alexey Yerin to ~sircmpwn/hare-dev
On Tue Jul 30, 2024 at 13:50 +0000, Ember Sawady wrote: > On Mon Jul 29, 2024 at 12:39 AM UTC, wrote: > > diff --git a/content/tutorials/introduction.md b/content/tutorials/introduction.md > > @@ -306,9 +306,9 @@ sections: > > <div class="alert"> > > <strong>Note:</strong> > > If you are not already familiar with binary floating point arithmetic, > > - you may be surprised when arithmetic using f32 and f64 types gives > > - unexpected results. Programmers unfamiliar with the subject are > > - encouraged to read the <a > > + you may be surprised when arithmetic using <code>f32</code> and > > + <code>f64</code> types gives unexpected results. Programmers unfamiliar > > + with the subject are encouraged to read the <a >
From Alexey Yerin to ~sircmpwn/hare-dev
Signed-off-by: Alexey Yerin <yyp@disroot.org> --- language/expressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/expressions.tex b/language/expressions.tex index d7a6eb8..5dc410b 100644 --- a/language/expressions.tex +++ b/language/expressions.tex @@ -1098,7 +1098,7 @@ execution environment shall print a diagnostic message and abort. \nonterminaldef{delete-operand} \\ \nonterminal{indexing-expression} \\ \nonterminal{slicing-expression} \\ \terminal{(} \nonterminal{insert-operand} \terminal{)} \\[message trimmed]
From Alexey Yerin to ~sircmpwn/hare-dev
Signed-off-by: Alexey Yerin <yyp@disroot.org> --- src/type_store.c | 3 +++ tests/26-regression.ha | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/type_store.c b/src/type_store.c index 6c63dae..4683cea 100644 --- a/src/type_store.c +++ b/src/type_store.c @@ -709,6 +709,9 @@ default_param_from_atype(struct context *ctx, // updated later, so it cannot be on the stack. struct expression *in = xcalloc(1, sizeof(struct expression)); check_expression(ctx, aparam->default_value, in, param->type); [message trimmed]
From Alexey Yerin to ~sircmpwn/hare-dev
Signed-off-by: Alexey Yerin <yyp@disroot.org> --- net/uri/parse.ha | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/net/uri/parse.ha b/net/uri/parse.ha index f8299fe7..2a216919 100644 --- a/net/uri/parse.ha +++ b/net/uri/parse.ha @@ -12,13 +12,6 @@ use strings; // The URI provided to [[parse]] is invalid. export type invalid = !void; fn free_non_empty(in: (str | ip::addr6)) void = {[message trimmed]