Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8717 closed bug (invalid)

Segfault in 64-bit Windows GHCi

Reported by: awson Owned by:
Priority: high Milestone: 7.8.1
Component: GHCi Version: 7.8.1-rc1
Keywords: Cc: hvr
Operating System: Windows Architecture: x86_64 (amd64)
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This code:

module Bug where

import Data.Data

c :: Constr
c = toConstr False

gives segfault when trying to evaluate c.

Attachments (1)

untrampoline_GetCommandLineW.patch (819 bytes) - added by awson 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by awson

comment:1 Changed 5 years ago by awson

Phew. That was a nightmarish debugging experience.

At last, I've found that some code in base wants to access GetCommandLineW not at an exact trampolined address but with +1 offset.

I am extremely tired, so I've decided to not dig further in GHCi with base interaction and simply exposed GetCommandLineW to GHCi statically. Thus, GetCommandLineW is loaded by a system linker and is not trampolined anymore.

This is an ugly hack, but it works and makes GHC build, for example, llvm-general package - impossible thing before.

This patch applies to 7.8 and HEAD.

Last edited 5 years ago by awson (previous) (diff)

comment:2 Changed 5 years ago by awson

Priority: normalhigh
Status: newpatch

comment:3 Changed 5 years ago by awson

Disregard the whole ticket. It was a weird artifact of #7134.

comment:4 Changed 5 years ago by awson

Resolution: invalid
Status: patchclosed

comment:5 Changed 5 years ago by Austin Seipp <austin@…>

In 2b33f6e8045fcd00f19883bb5e8895cbaf1bf81e/ghc:

Final fix to #7134 (and #8717 as well.)

Signed-off-by: Austin Seipp <>
Note: See TracTickets for help on using tickets.