79195949

Date: 2024-11-16 19:57:12
Score: 0.5
Natty:
Report link

I ended up trying lots of stuff, checking llvm ir from different c programs with variadic functions, clever chat gpt prompts and managed to fix the issue by appenind , i32 128 at the %.va_list:

The working println function code is:

define void @println(i8* %a, ...) {
entry:
    %.va_list = alloca i8, i32 128 ; here is the appended alignment
    call void @llvm.va_start(i8* %.va_list)
    call void @vprintf(i8* %a, i8* %.va_list)
    call void @printf(i8* @.str_3)
    call void @llvm.va_end(i8* %.va_list)
    ret void
}

ChatGPT thread that helped me: https://chatgpt.com/share/6738f7c5-3994-800e-90ab-5af879464fa8

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: johron