Debug info with recursive canonical type usage could cause segfault.

This commit is contained in:
Christoffer Lerno
2024-08-15 20:22:56 +02:00
parent 85c682f7e6
commit dc44254ba1
3 changed files with 7 additions and 8 deletions

View File

@@ -71,6 +71,7 @@
- Assert not properly traced #1354.
- Ordering issues with `$include` / `$exec` fixed #1302.
- Issues with wincrt linking.
- Debug info with recursive canonical type usage could cause segfault.
### Stdlib changes

View File

@@ -604,7 +604,7 @@ static void gencontext_verify_ir(GenContext *context)
{
if (*error)
{
puts("IR integrity failure.");
eprintf("----------------------------------IR integrity failure:\n");
LLVMDumpModule(context->module);
error_exit("Could not verify IR: %s", error);
}
@@ -1511,9 +1511,9 @@ void **llvm_gen(Module** modules, unsigned module_count)
}
for (unsigned i = 0; i < module_count; i++)
{
GenContext *result = llvm_gen_module(modules[i], NULL);
if (!result) continue;
vec_add(gen_contexts, result);
GenContext *result = llvm_gen_module(modules[i], NULL);
if (!result) continue;
vec_add(gen_contexts, result);
}
if (compiler.build.benchmarking)
{

View File

@@ -569,11 +569,9 @@ static LLVMMetadataRef llvm_debug_func_type(GenContext *c, Type *type)
static inline LLVMMetadataRef llvm_get_debug_type_internal(GenContext *c, Type *type, LLVMMetadataRef scope)
{
if (type->backend_debug_type) return type->backend_debug_type;
Type *canonical = type->canonical;
if (canonical != type)
if (type->backend_debug_type)
{
return type->backend_debug_type = llvm_get_debug_type(c, canonical);
return type->backend_debug_type;
}
// Consider special handling of UTF8 arrays.
switch (type->type_kind)