[jhc] [bug][jhc 7.7] about newIOArray: variable undeclared in the generated C source

emacsray at gmail.com emacsray at gmail.com
Tue Dec 6 20:11:35 CET 2011


Hi all,

The generated C source hs.out_code.c cannot be compiled due to
an undeclared variable. Here is the snippet code which can reproduce the
issue.


import Data.Array.IO
main = do
    arr <- newIOArray (0,42) 0 :: IO (IOArray Int Int)
    print 13


Here is the excerpt from jhc's output:


Writing "hs.out_code.c"
Running: gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math -Wextra -Wall -Wno-unused-parameter -fno-strict-aliasing -o hs.out hs.out_code.c -DNDEBUG -O3 '-D_JHC_GC=_JHC_GC_JGC'
hs.out_code.c: In function ‘ftheMain’:
hs.out_code.c:1867:27: error: ‘v119549094’ undeclared (first use in this function)
hs.out_code.c:1867:27: note: each undeclared identifier is reported only once for each function it appears in
hs.out_code.c: In function ‘fx57580221’:
hs.out_code.c:1886:24: warning: comparison between signed and unsigned integer expressions
hs.out_code.c:1889:9: warning: statement with no effect
hs.out_code.c:1926:17: warning: statement with no effect
jhc: user error (C code did not compile.)


The whole session is enclosed as `typescript'.


Btw, jhc 7.7  cannnot be compiled on ghc 7.0.4 smoothly. I add `{-#
LANGUAGE TypeFamilies #-}' and `import Data.Generics hiding (empty)' to
get it compiled.

--
Regards,
Ray
----------------------------
site: http://maskray.tk
----------------------------



More information about the jhc mailing list