Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app node argument has type fn[…] but the callee was expecting closure […] #159

Open
michael-kenzel opened this issue Jun 13, 2024 · 2 comments

Comments

@michael-kenzel
Copy link
Contributor

michael-kenzel commented Jun 13, 2024

This bug seems to only trigger on Windows (possibly only when built with MSVC).

The following example will reproduce the bug (compile with --emit-llvm, removing pretty much anything makes the bug disappear):

// any fewer functions will not trigger the bug
// any change to the type of any function makes the bug disappear as well
#[import(name = "A")] fn A(&mut u64, u64) -> u64;
#[import(name = "B")] fn B(&mut i32, i32) -> i32;
#[import(name = "C")] fn C(&mut u32, u32) -> u32;
#[import(name = "D")] fn D(&mut u64, u64) -> u64;

struct thing {
	A: fn() -> (),
	B: fn() -> (),
	C: fn() -> (),
	D: fn() -> (),
}

fn @wrap[T](f: fn(&mut T, T) -> T) {
	@|| -> () {}
}

fn @invoke(body: fn(thing) -> ()) -> () {
	@body(thing {
		A = wrap[u64](A),
		B = wrap[i32](B),
		C = wrap[u32](C),
		D = wrap[u64](D),
	})
}

#[export]
fn print_info(_device: i32) {
	invoke(|_|{});
}

#[export]
fn run(_device: i32, _argc: i32, _argv: &mut u8) {
	invoke(|_|{});
}

results in

assertion 'pt == at' failed in src\thorin\continuation.cpp:57: app node argument wrap_892(run_1534.run_1535, A_1555, cont_901) has type fn[mem, pu64*, pu64, fn[mem, pu64]] but the callee was expecting closure [mem, pu64*, pu64, fn[mem, pu64]]
@Hugobros3
Copy link
Contributor

Can you provide a commit hash?

@michael-kenzel
Copy link
Contributor Author

thorin: fb0f721
artic: 0f50091011f2bf82efd460264f2f40781a85f72b
runtime: 5c1a78c07cbeaea16fd61c73e92fd7112dd62ab7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants