[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:15:01 CET 2011


On Tue, Dec 06, 2011 at 07:11:35PM +0000, emacsray at gmail.com wrote:
> 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
> ----------------------------

Sorry, I forgot to enclose the attachment.

--
Regards,
Ray
----------------------------
site: http://maskray.tk
----------------------------
-------------- next part --------------
sh-4.2$ jhc a.hs
jhc a.hs
jhc 0.7.7 (0.7.6-53)
Finding Dependencies...
Using Ho Cache: '/home/ray/.jhc/cache'
Main                    [a.hs] <~/.jhc/cache/ckmpahu0fc5pq8vvl6q6pnim54.ho>
Fresh: <~/.jhc/cache/ckmpahu0fc5pq8vvl6q6pnim54.ho>
Typechecking...
Compiling...
Collected Compilation...
-- typeAnalyzeMethods
-- BoxifyProgram
-- Boxy WorkWrap
-- LambdaLift
E
├─case: 17
├─case-alt: 21
├─lambda: 7
├─let-binding: 9
├─lit: 23
├─other: 12
├─prim: 9
└─var-use: 42
Converting to Grin...
Found 0 CAFs to convert to constants, 0 of which are recursive.
Recursive

Constant

CAFS

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.)
sh-4.2$ exit


More information about the jhc mailing list