[LLVMdev] misaligned_stack_error caused by LLVM code on MacOS: how to fix?

Yuri yuri at rawbw.com
Sat Jan 1 04:26:21 PST 2011


llvm-generated code that runs fine on linux/i386 causes EXC_BAD_ACCESS 
with misaligned_stack_error_ on MacOS/i386.

I read online that each function should have stack aligned by 16 on 
MacOS/i386 and such code should be used:

Fn->addAttribute(~0U, llvm::Attribute::constructStackAlignmentFromInt(16));

But when I run clang on some C++ code I don't see alignstack 
instructions generated at all.

What is the right way for fix this misaligned_stack_error?

Yuri



More information about the llvm-dev mailing list