~yerinalexey


#917 Using Hare varargs with an incomplete type segfaults harec 9 months ago

bug added by ~yerinalexey on ~sircmpwn/hare

#917 Using Hare varargs with an incomplete type segfaults harec 9 months ago

harec added by ~yerinalexey on ~sircmpwn/hare

#917 Using Hare varargs with an incomplete type segfaults harec 9 months ago

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.

#825 +libc on freebsd doesn't work 9 months ago

Comment by ~yerinalexey on ~sircmpwn/hare

Fixed by d0be4a65

REPORTED RESOLVED FIXED

#880 unix::signal: accessing siginfo segfaults on FreeBSD 1 year, 1 month ago

Comment by ~yerinalexey on ~sircmpwn/hare

Oops, turns out you need to pass SA_SIGINFO to get a valid siginfo pointer. The real solution is to warn about this somewhere in the documentation, as well as providing flag::SIGINFO.

REPORTED RESOLVED NOT_OUR_BUG

#880 unix::signal: accessing siginfo segfaults on FreeBSD 1 year, 1 month ago

bug added by ~yerinalexey on ~sircmpwn/hare

#880 unix::signal: accessing siginfo segfaults on FreeBSD 1 year, 1 month ago

freebsd added by ~yerinalexey on ~sircmpwn/hare

#880 unix::signal: accessing siginfo segfaults on FreeBSD 1 year, 1 month ago

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  	};

#807 allow using static assert/abort in global context 1 year, 1 month ago

Comment by ~yerinalexey on ~sircmpwn/hare

Sebastian referenced this ticket in commit 8ec5041.

#868 Function pointers are not assignable to pointers to aliases of functions within tagged unions 1 year, 2 months ago

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