Opened 4 years ago

Closed 2 years ago

#9877 closed bug (invalid)

ForeignImport coercion evaluated before typechecking

Reported by: varosi Owned by:
Priority: normal Milestone:
Component: GHC API Version: 7.8.3
Keywords: Cc:
Operating System: Windows Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: #8588 Differential Rev(s):
Wiki Page:

Description (last modified by varosi)

Under Windows 8.1 x64 with Haskell Platform 2014.02 and EclipseFP I got:

buildwrapper.exe: panic! (the 'impossible' happened)
  (GHC version 7.8.3 for x86_64-unknown-mingw32):
ForeignImport coercion evaluated before typechecking

on the first line of file that has:

Code highlighting:

{-# LANGUAGE ForeignFunctionInterface, RankNTypes, OverloadedStrings, ScopedTypeVariables #-}
module Persist( persistWrite, persistRead ) where

import System.Win32.Types
import Graphics.Win32.GDI.Types
import Foreign.C.String
import Foreign.Marshal.Array
import Control.Exception

foreign import ccall unsafe "SHGetFolderPathW"
    cSHGetFolderPathW :: HWND -> INT -> HANDLE -> DWORD -> CWString -> IO LONG

Attachments (1)

GHCBug-0.1.tar.gz (998 bytes) - added by varosi 4 years ago.
When I open it in EclipseFP right after start of compilation it crashes.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 4 years ago by varosi

Description: modified (diff)

comment:2 Changed 4 years ago by simonpj

Can you give exact steps to reproduce? Does it have to depend on Graphics.Win32? Does the compiler crash, or does it crash when you run the program?

comment:3 Changed 4 years ago by varosi

Compiler is crashing I think. I have not written buildwrapper project. But it is happening during code writting and not during run-time.

comment:4 Changed 4 years ago by varosi

If I comment "import Graphics.Win32...." line it gives another error that is normal, because of missing import. So it is not crashing then.

comment:5 Changed 4 years ago by simonpj

Can I ask once more that you give the precise steps required to produce the crash?

Thanks

Simon

Changed 4 years ago by varosi

Attachment: GHCBug-0.1.tar.gz added

When I open it in EclipseFP right after start of compilation it crashes.

comment:6 Changed 4 years ago by varosi

When I build it directly from Cabal it does not crash.

comment:7 Changed 4 years ago by varosi

As I know buildwrapper is using GHC API, but I don't know how could I test it out of EclipseFP.

This is buildwrapper project: https://github.com/JPMoresmau/BuildWrapper

comment:8 Changed 3 years ago by thomie

Component: CompilerGHC API
Status: newinfoneeded

When I build it directly from Cabal it does not crash.

So this is most likely a bug in the GHC API. Perhaps Windows only. Perhaps already fixed, but we can't be sure without a way to reproduce (without relying on Eclipse FP or BuildWrapper).

As mentioned by the BuildWrapper author in https://github.com/JPMoresmau/BuildWrapper/issues/49#issuecomment-67013339:

What you should do is try to narrow the bug down by writing directly the GHC code. In https://ghc.haskell.org/trac/ghc/ticket/9845#no1 you can see I did that to expose another bug. The code buildwrapper used to invoke GHC is in the GHC module.

Also note that the BuildWrapper Github page currently says:

BuildWrapper is currently NOT maintained anymore. Feel free to fork and take up maintainership!

comment:9 Changed 2 years ago by Phyx-

Resolution: invalid
Status: infoneededclosed

This bug is quite old, and given that the GHC api has changed a lot in the meantime and that BuildWrapper is dead and unsupported we can't really reproduce this on the current GHC.

I am therefore closing this ticket. But feel free to re-open if you have a simple repro on GHC 8.

Note: See TracTickets for help on using tickets.