Hello,
I recently read the following:
[EMAIL PROTECTED]:~/Documents/pi3/diverses/Mascheroni> ghci Exponent.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Skipping  TheLog           ( ./TheLog.hs, ./TheLog.o )
Compiling Exponent         ( Exponent.hs, interpreted )
ghc-6.2: panic! (the `impossible' happened, GHC version 6.2):
        Bytecode generator can't handle unboxed tuples.  Possibly due
        to foreign import/export decls in source.  Workaround:
        compile this module to a .o file, then restart session.

The complete code of both modules is attached, as well as system information 
(I know not much about such things, so I can only hope that is helpful for 
you).

Compiling Exponent to a .o file did work, so there is no real problem.
However, ghci said 'Please report it as a compiler bug', so I am doing it.
Besides, there are no tuples at all in module Exponent, module TheLog, where 
there are a couple of tuples (are they unboxed though?) was compiled earlier,
so I don't understand the message. If you could spare the time to explain (or 
give a source for an explanation), I would be even more grateful than I am 
anyway (such a wonderful thing as ghc FOR FREE!!).

All the best to you,
Daniel Fischer
[EMAIL PROTECTED]:~/Documents/pi3/diverses/Mascheroni> ghci Exponent.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Skipping  TheLog           ( ./TheLog.hs, ./TheLog.o )
Compiling Exponent         ( Exponent.hs, interpreted )
ghc-6.2: panic! (the `impossible' happened, GHC version 6.2):
        Bytecode generator can't handle unboxed tuples.  Possibly due
        to foreign import/export decls in source.  Workaround:
        compile this module to a .o file, then restart session.

Please report it as a compiler bug to [email protected],
or http://sourceforge.net/projects/ghc/.


>

--------------------------------------------------------------------------
module Exponent where

import TheLog (theLog)

expoN :: Int -> Rational -> Rational
expoN k x = expoNHelp k x 0

expoNHelp :: Int -> Rational -> Rational -> Rational
expoNHelp k x val | k <= 0 = 1 + val
                  | otherwise = expoNHelp (k-1) x nval
                    where
                       nval = x*(1+val)/(fromIntegral k)

exSteps :: Rational -> Rational -> Int
exSteps x eps | eps <= 0  = error "exSteps: eps <= 0"
              | otherwise = exStepHelp x eps 1 0

exStepHelp :: Rational -> Rational -> Rational -> Int -> Int
exStepHelp x eps yet k | now*m < (m-x)*eps = k
                       | otherwise = exStepHelp x eps now (k+1)
                         where
                           m = fromIntegral k + 1
                           now = yet*x/m

expoEps :: Rational -> Rational -> Rational
expoEps x eps = expoN k x
                where
                   k = exSteps (abs x) eps

expoStell :: Int -> Rational -> Rational
expoStell n x = expoEps x (4/10^(n+1))

checkExLog :: Int -> Rational -> Bool
checkExLog k x = abs (expoStell k (theLog k x) - x) < 1/10^k

checkLogEx :: Int -> Rational -> Bool
checkLogEx k x = abs (theLog k (expoStell k x) - x) < 1/10^k
---------------------------------------------------------------------------

module TheLog where

import Data.Ratio

theSteps :: Rational -> Rational -> Int
theSteps x eps | eps <= 0 = error "theSteps: eps <= 0"
               | x  <  0  = error "theSteps: x < 0"
               | x  >= 1  = error "theSteps: x >= 1"
               | otherwise = stepsHelp x ((1-x)*eps) 1 1

stepsHelp :: Rational -> Rational -> Int -> Rational -> Int
stepsHelp x eps n val | val < (fromIntegral (2*n-1))*eps = n
                      | otherwise = stepsHelp x eps (n+1) (val*x)

theSum :: Rational -> Int -> Rational
theSum x k = sum [x^i/(fromIntegral i * 2 + 1) | i <- [0 .. k]]

logSum :: Rational -> Rational -> Rational
logSum s eps = theSum x k
               where
                  x = s^2
                  k = theSteps x eps

applog :: Rational -> Rational -> Rational
applog s eps = logSum s eps * 2* s

smallLog :: Int -> Rational -> Rational
smallLog n x = applog ((x-1)/(1+x)) (1/10^(n+1))

splitTen :: Rational -> (Rational, Rational)
splitTen x | x^2 > 10   = (s, k+1)
           | x^2 < 1%10 = (t, l-1)
           | otherwise  = (x, 0)
             where
                (s, k) = splitTen (x/10)
                (t, l) = splitTen (10*x)

log10 :: Int -> Rational
log10 k = log2 (k+1) * 3 + (smallLog (k+1) (5%4))

log2 :: Int -> Rational
log2 k = smallLog (k+1) (5%4) * 3 + (smallLog (k+1) (128%125))

fineLog :: Int -> Rational -> Rational
fineLog k x | x <= 0 = error "fineLog: x <= 0"
            | k < 2  = error "fineLog: k < 2"
            | x > 4%3 = fineLog (k+1) (x/2) + (log2 (k+1))
            | x < 2%3 = fineLog (k+1) (2*x) - (log2 (k+1))
            | otherwise = smallLog k x

theLog :: Int -> Rational -> Rational
theLog n x | x <= 0 = error "theLog: x <= 0"
           | n < 2  = error "theLog: n < 2"
           | x^2 > 10 || x^2 < 1%10 = fineLog (n+1) s + (log10 (n+2) * m)
           | otherwise  = fineLog (n+1) x
             where
                (s, m) = splitTen x
---------------------------------------------------------------------------

[EMAIL PROTECTED]:~/Documents/javathings/zahlentheorie> uname -a
Linux linux 2.4.20-4GB-athlon #1 Mon Mar 17 17:56:47 UTC 2003 i686 unknown 
unknown GNU/Linux

[EMAIL PROTECTED]:~/Documents/javathings/zahlentheorie> gcc -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr 
--with-local-prefix=/usr/local --infodir=/usr/share/info 
--mandir=/usr/share/man --libdir=/usr/lib 
--enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj 
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib 
--enable-shared --enable-__cxa_atexit i486-suse-linux
Thread model: posix
gcc version 3.3 20030226 (prerelease) (SuSE Linux)

[EMAIL PROTECTED]:~/Documents/pi3/diverses/Mascheroni> ghc -v -c Exponent.hs
Glasgow Haskell Compiler, Version 6.2, for Haskell 98, compiled by GHC version 
6.2
Using package config file: /usr/lib/ghc-6.2/package.conf

==================== Packages ====================
Package
   {name = "data",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/data"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSdata"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["haskell98", "lang", "util"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "rts",
    auto = False,
    import_dirs = [],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSrts"],
    extra_libraries = ["m", "gmp", "dl"],
    include_dirs = ["/usr/lib/ghc-6.2/include"],
    c_includes = ["Stg.h"],
    package_deps = [],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts =
      ["-u",
       "GHCziBase_Izh_static_info",
       "-u",
       "GHCziBase_Czh_static_info",
       "-u",
       "GHCziFloat_Fzh_static_info",
       "-u",
       "GHCziFloat_Dzh_static_info",
       "-u",
       "GHCziPtr_Ptr_static_info",
       "-u",
       "GHCziWord_Wzh_static_info",
       "-u",
       "GHCziInt_I8zh_static_info",
       "-u",
       "GHCziInt_I16zh_static_info",
       "-u",
       "GHCziInt_I32zh_static_info",
       "-u",
       "GHCziInt_I64zh_static_info",
       "-u",
       "GHCziWord_W8zh_static_info",
       "-u",
       "GHCziWord_W16zh_static_info",
       "-u",
       "GHCziWord_W32zh_static_info",
       "-u",
       "GHCziWord_W64zh_static_info",
       "-u",
       "GHCziStable_StablePtr_static_info",
       "-u",
       "GHCziBase_Izh_con_info",
       "-u",
       "GHCziBase_Czh_con_info",
       "-u",
       "GHCziFloat_Fzh_con_info",
       "-u",
       "GHCziFloat_Dzh_con_info",
       "-u",
       "GHCziPtr_Ptr_con_info",
       "-u",
       "GHCziPtr_FunPtr_con_info",
       "-u",
       "GHCziStable_StablePtr_con_info",
       "-u",
       "GHCziBase_False_closure",
       "-u",
       "GHCziBase_True_closure",
       "-u",
       "GHCziPack_unpackCString_closure",
       "-u",
       "GHCziIOBase_stackOverflow_closure",
       "-u",
       "GHCziIOBase_heapOverflow_closure",
       "-u",
       "GHCziIOBase_NonTermination_closure",
       "-u",
       "GHCziIOBase_BlockedOnDeadMVar_closure",
       "-u",
       "GHCziIOBase_Deadlock_closure",
       "-u",
       "GHCziWeak_runFinalizzerBatch_closure",
       "-u",
       "__stginit_Prelude"],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "base",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSbase"],
    extra_libraries = ["HSbase_cbits"],
    include_dirs = [],
    c_includes = ["HsBase.h"],
    package_deps = ["rts"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "haskell98",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HShaskell98"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "haskell-src",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HShaskell-src"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["base", "haskell98"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "network",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSnetwork"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = ["HsNet.h"],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "parsec",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSparsec"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "QuickCheck",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSQuickCheck"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "readline",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSreadline"],
    extra_libraries = ["readline", "ncurses"],
    include_dirs = [],
    c_includes = ["HsReadline.h"],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "unix",
    auto = True,
    import_dirs = ["/usr/lib/ghc-6.2/imports"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSunix"],
    extra_libraries = ["HSunix_cbits", "dl"],
    include_dirs = [],
    c_includes = ["HsUnix.h"],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "lang",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/lang"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSlang"],
    extra_libraries = ["HSlang_cbits"],
    include_dirs = [],
    c_includes = ["HsLang.h"],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "concurrent",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/concurrent"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSconcurrent"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["base"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "posix",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/posix"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSposix"],
    extra_libraries = ["HSposix_cbits", "dl"],
    include_dirs = [],
    c_includes = ["HsPosix.h"],
    package_deps = ["lang", "unix"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "util",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/util"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSutil"],
    extra_libraries = ["HSutil_cbits"],
    include_dirs = [],
    c_includes = ["HsUtil.h"],
    package_deps =
      ["lang", "concurrent", "QuickCheck", "readline", "posix"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "text",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/text"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HStext"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["lang", "parsec"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "net",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/net"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HSnet"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["network"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}
Package
   {name = "hssource",
    auto = False,
    import_dirs = ["/usr/lib/ghc-6.2/hslibs-imports/hssource"],
    source_dirs = [],
    library_dirs = ["/usr/lib/ghc-6.2"],
    hs_libraries = ["HShssource"],
    extra_libraries = [],
    include_dirs = [],
    c_includes = [],
    package_deps = ["haskell-src"],
    extra_ghc_opts = [],
    extra_cc_opts = [],
    extra_ld_opts = [],
    framework_dirs = [],
    extra_frameworks = []}


Hsc static flags: -static
*** Checking old interface for Exponent:
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 361
*** Simplify:
    Result size = 685
    Result size = 490
    Result size = 486
    Result size = 486
*** Tidy Core:
    Result size = 486
*** CorePrep:
    Result size = 558
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** Assembler
gcc -I. -I. -c /tmp/ghc2784.s -o Exponent.o
*** Deleting temp files
Deleting: /tmp/ghc2784.s
[EMAIL PROTECTED]:~/Documents/pi3/diverses/Mascheroni>
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to