Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c2hs always fails with "Prelude.head: empty list" #237

Closed
arsdragonfly opened this issue May 18, 2019 · 3 comments
Closed

c2hs always fails with "Prelude.head: empty list" #237

arsdragonfly opened this issue May 18, 2019 · 3 comments

Comments

@arsdragonfly
Copy link

Using the simple test in tests/system/simple:

$ c2hs -d trace Simple.chs
Attempting to read file `Simple.chs'...
...parsing `Simple'...
...successfully loaded `Simple'.
Invoking cpp as `cpp -x c -U__BLOCKS__ -DC2HS_VERSION_MAJOR=0 -DC2HS_VERSION_MINOR=28 -DC2HS_VERSION_REV=6 Simple.chs.h'...
Attempting to read file `Simple.i'...
...parsing `Simple.i'...
c2hs: Prelude.head: empty list

running with -d chs yields

-- GENERATED by C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017 (C->HS binding
)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "Simple.chs" #-}
module Main
where

main :: IO ()
main  = {#call foo#}
{-# LINE 5 "Simple.chs" #-}

I suspect it's a different issue from #192

@arsdragonfly
Copy link
Author

Ignore the previous backtrace; here's the correct one

./dist/build/c2hs/c2hs tests/system/simple/Simple.chs +RTS -xc                     master ✗
*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace: 
  Control.StateTrans.liftIO.\,
  called from Control.StateTrans.liftIO,
  called from Control.StateBase.liftIO,
  called from Control.StateBase.+>=.\,
  called from Control.StateTrans.+>=.\.\.(...),
  called from Control.StateTrans.+>=.\.\,
  called from Control.StateTrans.+>=.\,
  called from Control.StateTrans.+>=,
  called from Control.StateBase.+>=,
  called from Main.compile,
  called from Control.StateTrans.fatalsHandledBy.\,
  called from Control.StateTrans.fatalsHandledBy,
  called from Control.State.fatalsHandledBy,
  called from Control.StateBase.unpackCST,
  called from Control.State.run.m,
  called from Control.StateTrans.runSTB,
  called from Control.State.run,
  called from C2HS.State.runC2HS,
  called from Main.main
*** Exception (reporting due to +RTS -xc): (THUNK), stack trace: 
  Control.StateTrans.liftIO.\,
  called from Control.StateTrans.liftIO,
  called from Control.StateBase.liftIO,
  called from System.CIO.createDirectoryIfMissing,
  called from Main.process,
  called from Main.execute,
  called from Main.compile.doExecute,
  called from Control.StateBase.+>=.\,
  called from Control.StateTrans.+>=.\.\.(...),
  called from Control.StateTrans.+>=.\.\,
  called from Control.StateTrans.+>=.\,
  called from Control.StateTrans.+>=,
  called from Control.StateBase.+>=,
  called from Main.compile,
  called from Control.StateTrans.fatalsHandledBy.\,
  called from Control.StateTrans.fatalsHandledBy,
  called from Control.State.fatalsHandledBy,
  called from Control.StateBase.unpackCST,
  called from Control.State.run.m,
  called from Control.StateTrans.runSTB,
  called from Control.State.run,
  called from C2HS.State.runC2HS,
  called from Main.main
*** Exception (reporting due to +RTS -xc): (THUNK), stack trace: 
  Control.StateTrans.liftIO.\,
  called from Control.StateTrans.liftIO,
  called from Control.StateBase.liftIO,
  called from System.CIO.createDirectoryIfMissing,
  called from Main.process,
  called from Main.execute,
  called from Main.compile.doExecute,
  called from Control.StateBase.+>=.\,
  called from Control.StateTrans.+>=.\.\.(...),
  called from Control.StateTrans.+>=.\.\,
  called from Control.StateTrans.+>=.\,
  called from Control.StateTrans.+>=,
  called from Control.StateBase.+>=,
  called from Main.compile,
  called from Control.StateTrans.fatalsHandledBy.\,
  called from Control.StateTrans.fatalsHandledBy,
  called from Control.State.fatalsHandledBy,
  called from Control.StateBase.unpackCST,
  called from Control.State.run.m,
  called from Control.StateTrans.runSTB,
  called from Control.State.run,
  called from C2HS.State.runC2HS,
  called from Main.main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace: 
  GHC.List.CAF
  --> evaluated by: Language.C.Parser.Lexer.lexC,
  called from Language.C.Parser.ParserMonad.execParser,
  called from C2HS.C.parseHeader,
  called from C2HS.C.loadAttrC,
  called from Main.process,
  called from Main.execute,
  called from Main.compile.doExecute,
  called from Control.StateBase.+>=.\,
  called from Control.StateTrans.+>=.\.\.(...),
  called from Control.StateTrans.+>=.\.\,
  called from Control.StateTrans.+>=.\,
  called from Control.StateTrans.+>=,
  called from Control.StateBase.+>=,
  called from Main.compile,
  called from Control.StateTrans.fatalsHandledBy.\,
  called from Control.StateTrans.fatalsHandledBy,
  called from Control.State.fatalsHandledBy,
  called from Control.StateBase.unpackCST,
  called from Control.State.run.m,
  called from Control.StateTrans.runSTB,
  called from Control.State.run,
  called from C2HS.State.runC2HS,
  called from Main.main
*** Exception (reporting due to +RTS -xc): (base:GHC.Exception.Type.SomeException), stack trace: 
  Control.StateTrans.fatalsHandledBy.\,
  called from Control.StateTrans.fatalsHandledBy,
  called from Control.State.fatalsHandledBy,
  called from Control.StateBase.unpackCST,
  called from Control.State.run.m,
  called from Control.StateTrans.runSTB,
  called from Control.State.run,
  called from C2HS.State.runC2HS,
  called from Main.main,
  called from GHC.List.CAF
*** Exception (reporting due to +RTS -xc): (base:GHC.Exception.Type.SomeException), stack trace: 
  Control.StateTrans.fatalsHandledBy.\,
  called from Control.StateTrans.fatalsHandledBy,
  called from Control.State.fatalsHandledBy,
  called from Control.StateBase.unpackCST,
  called from Control.State.run.m,
  called from Control.StateTrans.runSTB,
  called from Control.State.run,
  called from C2HS.State.runC2HS,
  called from Main.main,
  called from GHC.List.CAF
c2hs: Prelude.head: empty list

@arsdragonfly
Copy link
Author

failing all of the test cases with the same error

@arsdragonfly
Copy link
Author

See #238 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant