-
-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The code below produces wrong result.
To Reproduce
Steps to reproduce the behavior:
- code:
async fn fetch_data() -> string {
return "some data";
}
fn main() {
let result = await fetch_data();
println "result: {result}";
return 0;
}
It shows:
result: @
Expected behavior
It shows wrong result:
result: some data
Screenshots
Environment (please complete the following information):
- OS: Fedore 43
- Zen C Version: zc v0.4.2-38-ge4605ce
- Compiler:
- gcc (GCC) 15.2.1 20260123
- clang version 21.1.8
Additional context
A discussion in discord, from Alex:
There's a bug in the compiler.
It outputs
string *res_ptr = malloc(sizeof(string));
*res_ptr = _impl_fetch_data();
free(args);
return (void*)res_ptr; //<----- cast char** to void*
}
It should be outputting
string res_ptr = malloc(sizeof(string));
res_ptr = _impl_fetch_data();
free(args);
return (void*)res_ptr; //<---- cast char* to void*
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done