#7510: Immediate seg-fault on 32-bit windows build
---------------------------------+------------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.8.1
Component: Compiler | Version: 7.6.1
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by joeyadams):
I think I found the bug, introduced by commit 0b0a41f: "Teach the linear
register allocator how to allocate more stack if necessary"
Somewhere in compiler/nativeGen/AsmCodeGen.lhs:
{{{
-- do linear register allocation
let reg_alloc proc = do
(alloced, maybe_more_stack, ra_stats) <-
Linear.regAlloc dflags proc
case maybe_more_stack of
Nothing -> return ( alloced, ra_stats )
Just amount ->
return ( ncgAllocMoreStack ncgImpl amount alloced
, ra_stats )
}}}
ncgAllocMoreStack is implemented by X86.Instr.allocMoreStack:
{{{
allocMoreStack
:: Platform
-> Int
-> NatCmmDecl statics X86.Instr.Instr
-> NatCmmDecl statics X86.Instr.Instr
allocMoreStack _ _ top@(CmmData _ _) = top
allocMoreStack platform amount (CmmProc info lbl live (ListGraph code)) =
CmmProc info lbl live (ListGraph (map insert_stack_insns code))
where
alloc = mkStackAllocInstr platform amount
dealloc = mkStackDeallocInstr platform amount
...
}}}
mkStackAllocInstr is implemented by x86_mkStackAllocInstr:
{{{
x86_mkStackAllocInstr
:: Platform
-> Int
-> Instr
x86_mkStackAllocInstr platform amount
= case platformArch platform of
ArchX86 -> SUB II32 (OpImm (ImmInt amount)) (OpReg esp)
ArchX86_64 -> SUB II64 (OpImm (ImmInt amount)) (OpReg rsp)
_ -> panic "x86_mkStackAllocInstr"
}}}
It looks to me like the amount is never multiplied to convert from slots
to bytes.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7510#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs