bug added by ~yerinalexey on ~sircmpwn/hare
harec added by ~yerinalexey on ~sircmpwn/hare
Ticket created by ~yerinalexey on ~sircmpwn/hare
Minimal reproduction:
fn fun(a: T...) void; export fn main() void = fun();The issue is in check.c:1479 (and a bit lower for no arguments case), where
param->type
can be have storage=STORAGE_ERROR if the type is not resolved, but this is not checked and the code assumes that the type is slice and gets a NULL pointer for the member type that is later dereferenced during type lookup.
Comment by ~yerinalexey on ~sircmpwn/hare
Fixed by d0be4a65
REPORTED
RESOLVED FIXEDComment by ~yerinalexey on ~sircmpwn/hare
Oops, turns out you need to pass
SA_SIGINFO
to get a validsiginfo
pointer. The real solution is to warn about this somewhere in the documentation, as well as providingflag::SIGINFO
.
REPORTED
RESOLVED NOT_OUR_BUGbug added by ~yerinalexey on ~sircmpwn/hare
freebsd added by ~yerinalexey on ~sircmpwn/hare
Ticket created by ~yerinalexey on ~sircmpwn/hare
Looks like the second parameter to the signal handler is null.
use unix::signal; use rt; use fmt; fn handle(sig: signal::sig, info: *signal::siginfo, uctx: *opaque) void = { fmt::printfln("signal={} errno={} code={}", signal::signame(sig), rt::strerror(info.errno), info.code: int)!; abort(); }; export fn main() void = { signal::handle(signal::sig::FPE, &handle); fmt::println(1 / 0)!; };Process 988 stopped * thread 1, name = 'b', stop reason = signal SIGFPE: integer divide by zero frame 0: 0x00000000080181c2 b`main at sigtest.ha:15 12 export fn main() void = { 13 signal::handle(signal::sig::FPE, &handle); 14 -> 15 fmt::println(1 / 0)!; 16 }; Process 988 resuming Process 988 stopped * thread 1, name = 'b', stop reason = signal SIGSEGV: invalid address (fault address: 0x6) frame 0: 0x00000000080182ca b`handle at sigtest.ha:7 4 5 fn handle(sig: signal::sig, info: *signal::siginfo, uctx: *opaque) void = { 6 fmt::printfln("signal={} errno={} code={}", -> 7 signal::signame(sig), rt::strerror(info.errno), 8 info.code: int)!; 9 abort(); 10 };
Comment by ~yerinalexey on ~sircmpwn/hare
Sebastian referenced this ticket in commit 8ec5041.
Ticket created by ~yerinalexey on ~sircmpwn/hare
type some_func = fn() void; type t = (*some_func | int); export fn main() void = { func(&empty); }; fn func(v: t) void = void; fn empty() void = void;This currently fails with
Argument type *fn() void is not assignable to parameter type t
. Works fine if the pointer is moved into the alias, or if&empty
is explicitly cast to*some_func
.Might be related to type hints somehow.
Relevant commits:
f2723ad7
- Make pointer/slice assignability rules more strict