hello,
i seem to have stumbled onto a bug in ghc.
here is my system info:
> root in base: uname -a
> Linux localhost.localdomain 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i686
>unknown
> root in base: gcc -v
> Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs
> gcc version 2.95.3 19991030 (prerelease)
this is the program causing the problem:
> root in base: cat hugsBug.hs
> module Main where
>
> class (?imp :: Int) => C t
>
> main = putStrLn "Hello"
>
here is what happens when i try to compile it:
> root in base: ghc -fglasgow-exts hugsBug.hs
>
> Prelude.(!!): index too large
here is the same thing with the -v flag:
> root in base: ghc -v -fglasgow-exts hugsBug.hs
> The Glorious Glasgow Haskell Compilation System, version 4.08.1
>
> Effective command line: -v -fglasgow-exts
>
> Ineffective C pre-processor:
> echo '{-# LINE 1 "hugsBug.hs" -}' > /tmp/ghc1434.cpp && cat hugsBug.hs >>
>/tmp/ghc1434.cpp
> 0.00user 0.01system 0:00.00elapsed 142%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (116major+18minor)pagefaults 0swaps
> ghc:compile:Interface file hugsBug.hi doesn't exist
> ghc:recompile:Input file hugsBug.hs newer than hugsBug.o
>
> Haskell compiler:
> /usr/lib/ghc-4.08.1/hsc /tmp/ghc1434.cpp -fglasgow-exts
>-fignore-interface-pragmas -fomit-interface-pragmas -fsimplify [
>-fmax-simplifier-iterations4 ] -fwarn-overlapping-patterns -fwarn-missing-methods
>-fwarn-missing-fields -fwarn-deprecations -fwarn-duplicate-exports -fhi-version=408
>-static
>"-himap=.%.hi:/usr/lib/ghc-4.08.1/imports/lang%.hi:/usr/lib/ghc-4.08.1/imports/lang%.hi:/usr/lib/ghc-4.08.1/imports/std%.hi"
> "-himap-sep=:" -v -hifile=/tmp/ghc1434.hi -olang=asm -ofile=/tmp/ghc1434.s
>-F=/tmp/ghc1434_stb.c -FH=/tmp/ghc1434_stb.h +RTS -H6000000 -K1000000
> Glasgow Haskell Compiler, version 4.08, for Haskell 98, compiled by GHC version
> 4.08
>
> Prelude.(!!): index too large
>
> Command exited with non-zero status 1
> 0.27user 0.05system 0:00.33elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (1348major+1597minor)pagefaults 0swaps
> deleting... /tmp/ghc1434.cpp /tmp/ghc1434.hi /tmp/ghc1434.s /tmp/ghc1434_stb.c
>/tmp/ghc1434_stb.h
>
> rm -f /tmp/ghc1434*
>
the problem seems to be the lack of functions in the class.
if i add a member function the file compiles fine.
the problem seems to be somehow related with the implict parameter
constraint as it does not occur if i place a normal class constraint instead.
i am vague on how exactly implict parameters are implemented, but i suspect
the compiler trys to somehow annotate all member functions with the
additional constraint and there is no check to see if there are any memebr
functions. unfortunately i dont have the source for the compiler
so all of the above is just speculation.
bye
iavor
--
+---------------------------------+---------------------------------------+
|Iavor S. Diatchki | email: [EMAIL PROTECTED] |
|Dept. of Computer Science | web: http://www.cse.ogi.edu/~diatchki |
|Oregon Graduate Institute | tel: 5037481631 |
+---------------------------------+---------------------------------------+
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs