(1) My environment
% uname -a
Linux nob 2.0.36 #6 Mon Mar 22 17:21:10 JST 1999 i686 unknown
(2) My gcc
% gcc --version
2.7.2.3
(3) My code (is almost the same one in "The Glasgow Haskell Compiler
User's Guide, Version 4.02" p51 section 5.4.1)
% cat OldGetEnv.lhs
> module OldGetEnv (oldGetEnv) where
>
> import IO
> import Addr
> import CCall
> import PrelPack
>
> oldGetEnv :: String -> IO (Either String String)
> oldGetEnv name = _casm_ ``%r = getenv((char *) %0);'' name >>= \ls@(A# str#)
> -> return (
> if (ls == A# ``NULL'') then
> Left ("Fail:oldGetEnv:" ++ name)
> else
> Right (unpackCString# str#)
> )
(4) What I did and what I got
% ghc -v -c OldGetEnv.lhs -fvia-c -fglasgow-exts
The Glorious Glasgow Haskell Compilation System, version 4.02, patchlevel 0
literate pre-processor:
/usr/local/lib/unlit OldGetEnv.lhs - >> /tmp/ghc601.lpp
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (55major+11minor)pagefaults 0swaps
Effective command line: -v -c -fvia-c -fglasgow-exts
Ineffective C pre-processor:
echo '{-# LINE 1 "OldGetEnv.lhs" -}' > /tmp/ghc601.cpp && cat /tmp/ghc601.lpp
>> /tmp/ghc601.cpp
0.00user 0.00system 0:00.03elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (68major+9minor)pagefaults 0swaps
ghc:compile:Output file OldGetEnv.o doesn't exist
ghc:compile:Interface file OldGetEnv.hi doesn't exist
ghc:recompile:Input file OldGetEnv.lhs newer than OldGetEnv.o
Haskell compiler:
/usr/local/lib/hsc ,-N ,-W ,/tmp/ghc601.cpp -fglasgow-exts
-fignore-interface-pragmas -fomit-interface-pragmas -fsimplify [
-ffloat-lets-exposing-whnf -ffloat-primops-ok -fcase-of-case -fdo-case-elim
-freuse-con -fpedantic-bottoms -fmax-simplifier-iterations4 ]
-fwarn-overlapping-patterns -fwarn-missing-methods -fwarn-duplicate-exports
-fhi-version=402
-himap=.%.hi:/usr/local/lib/imports/exts%.hi:/usr/local/lib/imports/exts%.hi:/usr/local/lib/imports/std%.hi
-v -hifile=/tmp/ghc601.hi -C=/tmp/ghc601.hc -F=/tmp/ghc601_stb.c
-FH=/tmp/ghc601_stb.h +RTS -H6000000 -K1000000
Glasgow Haskell Compiler, version 4.02, for Haskell 98
panic! (the `impossible' happened):
ERROR: ``literal-literal'' not a single-constructor type: NULL; type:
PrelGHC.Addrzh{-31,s-}
Please report it as a compiler bug to [EMAIL PROTECTED]
Command exited with non-zero status 1
0.44user 5.81system 0:06.59elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1007major+1748minor)pagefaults 0swaps
deleting... /tmp/ghc601.lpp /tmp/ghc601.cpp /tmp/ghc601.hi /tmp/ghc601.hc
/tmp/ghc601_stb.c /tmp/ghc601_stb.h
rm -f /tmp/ghc601*
--
Nobuo Yamashita
[EMAIL PROTECTED]