[GHC] #9877: ForeignImport coercion evaluated before typechecking

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Windows Architecture: x86_64 (amd64) | Type of failure: Compile- Difficulty: Unknown | time crash Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- 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: {{{ #!div style="font-size: 80%" Code highlighting: {{{#!haskell {-# 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 }}} }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Description changed by varosi: Old description:
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: {{{ #!div style="font-size: 80%" Code highlighting: {{{#!haskell {-# 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 }}} }}}
New description: 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: {{{ #!div style="font-size: 80%" Code highlighting: {{{#!haskell {-# 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 }}} }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (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? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): Can I ask once more that you give the ''precise steps'' required to produce the crash? Thanks Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by varosi): When I build it directly from Cabal it does not crash. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Compile- | Difficulty: Unknown time crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (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 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHC API | Version: 7.8.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: #8588 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => infoneeded * component: Compiler => GHC API * related: => #8588 Comment:
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! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9877: ForeignImport coercion evaluated before typechecking -------------------------------------+------------------------------------- Reporter: varosi | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: GHC API | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: #8588 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: infoneeded => closed * resolution: => invalid Comment: 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9877#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC