[LLVMbugs] [Bug 3322] New: __dyld_misaligned_stack_error on Mac OS X 10. 5 x86 when using system call

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jan 13 22:37:44 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=3322

           Summary: __dyld_misaligned_stack_error on Mac OS X 10.5 x86 when
                    using system call
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Interpreter
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alexei.svitkine at gmail.com
                CC: llvmbugs at cs.uiuc.edu


When using the Interpeter to execute the following code compiled with clang:

#include <stdio.h
int main(void)
{
  perror(0);
  return 0;
}

I get a crash as a result of a __dyld_misaligned_stack_error(). However, the
same code runs fine using when ForceInterpreter is set to false when creating
the ExecutionEngine.

A Google search suggests that the stack must be 16-byte aligned for system
calls to work correctly on Mac OS X x86:

http://stackoverflow.com/questions/5649/x86-assembly-on-a-mac

The back trace is as follows:

#0  0x8fe18c02 in __dyld_misaligned_stack_error ()
#1  0x00204e4f in llvm::PATypeHolder::get (this=0xbffff130) at Type.h:406
#2  0x009f5de1 in llvm::APInt::initSlowCase (this=0xbffff130, that=@0xbffff0cc)
at APInt.cpp:54
#3  0x0028fc6c in llvm::APInt::APInt (this=0xbffff130, that=@0xbffff0cc) at
ADT/APInt.h:250
#4  0x002efe02 in llvm::GenericValue::GenericValue (this=0xbffff128) at
ExecutionEngine/GenericValue.h:26
#5  0x002ee8c7 in llvm::Interpreter::callExternalFunction (this=0x1c054f0,
F=0x1c0a4b0, ArgVals=@0xbffff214) at ExternalFunctions.cpp:119
#6  0x002e93c7 in llvm::Interpreter::callFunction (this=0x1c054f0, F=0x1c0a4b0,
ArgVals=@0xbffff214) at Execution.cpp:1309
#7  0x002e9ada in llvm::Interpreter::visitCallSite (this=0x1c054f0,
CS=@0xbffff2bc) at Execution.cpp:922
#8  0x002f60d6 in llvm::Interpreter::visitCallInst (this=0x1c054f0,
I=@0x1c0a518) at Interpreter.h:164
#9  0x002f60f0 in llvm::InstVisitor<llvm::Interpreter, void>::visitCall
(this=0x1c054f0, I=@0x1c0a518) at Instruction.def:159
#10 0x002f6b2a in llvm::InstVisitor<llvm::Interpreter, void>::visit
(this=0x1c054f0, I=@0x1c0a518) at Instruction.def:159
#11 0x002e9e17 in llvm::Interpreter::run (this=0x1c054f0) at Execution.cpp:1345
#12 0x002eeda4 in llvm::Interpreter::runFunction (this=0x1c054f0, F=0x1c09290,
ArgValues=@0xbffff3ec) at Interpreter.cpp:100
#13 0x0031639b in llvm::ExecutionEngine::runFunctionAsMain (this=0x1c054f0,
Fn=0x1c09290, argv=@0xbffff614, envp=0x0) at ExecutionEngine.cpp:357


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list