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

probable initialization errors of heap allocated objects #153

Open
chqrlie opened this issue Jan 20, 2025 · 0 comments
Open

probable initialization errors of heap allocated objects #153

chqrlie opened this issue Jan 20, 2025 · 0 comments

Comments

@chqrlie
Copy link
Contributor

chqrlie commented Jan 20, 2025

I amended the library file libs/libc/stdlib.c2 this way:

// [...]
import string;
// [...]
#if 1
public fn void* malloc(c_size size) {
    void *p = calloc(size, 1);
    if (p) return string.memset(p, 0xff, size);
    return p;
}
#else
fn void* malloc(c_size size);
#endif

Running some tests with this library patch makes the compiler hang on macOS with an infinite loop.

output/tester/tester -v test/template/function/opaque_template_arg_ok.c2t

I suspect this is caused by a missing initializer for a field in an object allocated from the heap (directly or indirectly).

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

1 participant