small program misbehaves with -fvia-C
stefan@stefans:/tmp$ mkdir bug
stefan@stefans:/tmp$ cd bug
stefan@stefans:/tmp/bug$ echo 'main = interact $ (show :: Bool -> String) . read' > bug.hs
stefan@stefans:/tmp/bug$ ghc -fasm bug.hs
stefan@stefans:/tmp/bug$ echo -n False | ./a.out
Falsestefan@stefans:/tmp/bug$ rm *
stefan@stefans:/tmp/bug$ echo 'main = interact $ (show :: Bool -> String) . read' > bug.hs
stefan@stefans:/tmp/bug$ ghc -fvia-C bug.hs
/tmp/ghc12591_0/ghc12591_0.hc: In function 'rr5_entry':
/tmp/ghc12591_0/ghc12591_0.hc:33:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc:36:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc: In function 'srg_entry':
/tmp/ghc12591_0/ghc12591_0.hc:108:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc:111:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc:115:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc: In function 'Main_main_entry':
/tmp/ghc12591_0/ghc12591_0.hc:153:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc:156:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc: In function 'ZCMain_main_entry':
/tmp/ghc12591_0/ghc12591_0.hc:195:0:
warning: assignment makes integer from pointer without a cast
/tmp/ghc12591_0/ghc12591_0.hc:198:0:
warning: assignment makes integer from pointer without a cast
stefan@stefans:/tmp/bug$ echo -n False | ./a.out
a.out: internal error: stg_ap_p_ret
(GHC version 6.7.20070213 for i386_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Aborted
stefan@stefans:/tmp/bug$
The exact error seen depends in a not-yet-characterised way on the program; in addition to the above, correct behavior, immediate silent exit, and "Segmentation fault" have been seen.
Brandon S. Allbery on #haskell was able to reproduce using powerpc_apple_darwin (20070213) Lennary Augustsson on #haskell was not, using 20070216 "i386, Mac OS X"
Stefan