Opened 9 years ago

Closed 9 years ago

#5322 closed bug (fixed)

Windows build broken

Reported by: igloo Owned by: simonmar
Priority: highest Milestone: 7.2.1
Component: Compiler Version: 7.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

Some time between the 17th June: and the 8th July: the Windows build broke.

$ cat q.hs

module Main (main) where

import Foreign

foreign import ccall "wrapper" wrap_f_io :: IO () -> IO (FunPtr (IO ()))
foreign import ccall "dynamic" call_io :: FunPtr (IO ()) -> IO ()

fun :: IO ()
fun = putStrLn "Foo"

main :: IO ()
main = do f <- wrap_f_io fun
          call_io f
$ ../../../../../../inplace/bin/ghc-stage1.exe --make q -debug -rtsopts -Wall -dcore-lint -dcmm-lint -fforce-recomp
[1 of 1] Compiling Main             ( q.hs, q.o )
Linking q.exe ...

$ gdb q.exe
GNU gdb (cygwin-special)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) r +RTS -DS
Starting program: /cygdrive/c/msys/1.0/home/ian/ghc/testsuite/tests/ghc-regress/ffi/should_run/q/q.exe +RTS -DS
[New thread 208.0xd8]
created capset 0 of type 2
assigned cap 0 to capset 0

Program received signal SIGSEGV, Segmentation fault.
0x005a87fc in stg_ap_p_info ()

Change History (5)

comment:1 Changed 9 years ago by igloo

Description: modified (diff)

comment:2 Changed 9 years ago by simonmar

Owner: set to simonmar

Probably related to the fix for #5250

comment:3 Changed 9 years ago by marlowsd@…

commit 81eddb4c58c6d4171a46c727574112e2083c4878
Author: Simon Marlow <>
Date:   Mon Jul 18 13:48:53 2011 +0100

    Fix Windows breakage (#5322).  When I modified StgRun to use the pure
    assembly version as part of the fix for #5250, we inadvertently lost
    the Windows magic for extending the stack.  Win32 requires that the
    stack is extended a page at a time, otherwise you get a segfault.  The
    C compiler knows how to do this, so we now call a C stub to ensure
    there's enough stack space at each invocation of the scheduler.

comment:4 Changed 9 years ago by simonmar

Status: newmerge

should be fixed now.

comment:5 Changed 9 years ago by igloo

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.