"Hello World" program core dumps with GHC 4.08.1 on HPUX 10.20

BENNETT,ANDY (HP-Unitedkingdom,ex1) andy_bennett at hp.com
Mon Feb 5 08:03:17 EST 2001


Hello,

I'm not sure whether I'm doing something wrong, but I've just downloaded the
HPUX 4.08.1 binary distribution of GHC and have installed it with GCC 2.95.2
(downloaded from HPUX porting site) along side it. I'm running these on HPUX
10.20.

When I try the "Hello, world!" example program from the install guide, it
compiles okay, but on running it does the following:

    $ cat Main.hs
    main = putStr "Hello, world!\n"
    $ ghc -o hello Main.hs
    $ ./hello
    Memory fault(coredump)
    $ 

Hopefully there is something simple I haven't done, please find attached the
output of 'ghc -v'.

I burrowed around in the core file, and it looks like it is failing in
__init_Main which appears to be doing this:

    if (! _module_registered) {
         _module_registered = 1;
         { 
             extern F_ __init_Prelude(void) ;
             *(Sp++) = (W_)__init_Prelude ;
         }
    }

    do { void *_procedure = (void *)(*(--Sp)); goto *_procedure; } while(0);

It goes into the 'if' statement and hence the top element of Sp becomes a
pointer to __init_Prelude(). It then tries to call this by reading Sp's top
element and then goes to that address. This would be fine except that what
is really placed on Sp by the assignment is a pointer to the function's PLT
entry which has (function address, DLT pointer) pairs for each function. The
"goto" is just doing a simple vectored branch into the table rather than
using its entries to find the true address and jumping to that.

Any help would be appreciated.
Thanks,
Andy Bennett.




$ cat ghc.out
The Glorious Glasgow Haskell Compilation System, version 4.08.1

Effective command line: -v -o hello

Ineffective C pre-processor:
        echo '{-# LINE 1 "Main.hs" -}' > /tmp/ghc17398.cpp && cat Main.hs >>
/tmp/ghc17398.cpp

real        0.0
user        0.0
sys         0.0
ghc:compile:Output file Main.o doesn't exist
ghc:compile:Interface file Main.hi doesn't exist
ghc:recompile:Input file Main.hs newer than Main.o

Haskell compiler:
        /opt/ghc/lib/ghc-4.08.1/hsc /tmp/ghc17398.cpp
-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:/opt/ghc/lib/ghc-4.08.1/imports/std%.hi" "-himap-sep=:"    -v
-hifile=/tmp/ghc17398.hi -olang=C -ofile=/tmp/ghc17398.hc
-F=/tmp/ghc17398_stb.c -FH=/tmp/ghc17398_stb.h +RTS -H6000000 -K1000000
Glasgow Haskell Compiler, version 4.08, for Haskell 98, compiled by GHC
version 4.08

real        2.1
user        1.7
sys         0.3

Pin on Haskell consistency info:
        echo 'static char ghc_hsc_ID[] = "@(#)hsc Main.hs       40.0,,";' >>
/tmp/ghc17398.hc

real        0.0
user        0.0
sys         0.0
*** New hi file follows...
__interface "Main" Main  where
__export Main main;
import PrelFloat 1 !;
import Prelude 1;
main :: PrelIOBase.IO PrelBase.Z0T ;


ghc: module version changed to 1; reason: no old .hi file

Replace .hi file, if changed:
        cmp -s Main.hi /tmp/ghc17398.hi-new || ( rm -f Main.hi && cp
/tmp/ghc17398.hi-new Main.hi )

real        0.0
user        0.0
sys         0.0

C compiler:
        gcc -v  -D_HPUX_SOURCE -static -S -Wimplicit -O    -I.
-I/opt/ghc/lib/ghc-4.08.1/includes ghc17398.c > /tmp/ghc17398.ccout 2>&1 &&
( if [ ghc17398.s != /tmp/ghc17398_o.s ] ; then mv ghc17398.s
/tmp/ghc17398_o.s ; else exit 0 ; fi )
Reading specs from /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/cpp -lang-c -v -I.
-I/opt/ghc/lib/ghc-4.08.1/includes -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dhppa
-Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D__hppa__
-D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__
-D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -Asystem(unix)
-Asystem(hpux) -Acpu(hppa) -Amachine(hppa) -D__OPTIMIZE__ -Wimplicit
-D__hp9000s700 -D_PA_RISC1_1 -D_HPUX_SOURCE -D_HIUX_SOURCE -D__STDC_EXT__
-D_HPUX_SOURCE ghc17398.c /tmp/cc1qQp3b.i
GNU CPP version 2.95.2 19991024 (release) (hppa)
#include "..." search starts here:
#include <...> search starts here:
 .
 /opt/ghc/lib/ghc-4.08.1/includes
 /opt/gcc/include
 
/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/../../../../hppa1.1-hp-hpux
10.20/include
 /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/../../../../include/g++-3
End of omitted list.
 /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/cc1 /tmp/cc1qQp3b.i -quiet
-dumpbase ghc17398.c -O -Wimplicit -version -o ghc17398.s
GNU C version 2.95.2 19991024 (release) (hppa1.1-hp-hpux10.20) compiled by
CC.

real        1.4
user        1.1
sys         0.2

Unix assembler:
        gcc -o Main.o -c  -I. -I/opt/ghc/lib/ghc-4.08.1/includes
/tmp/ghc17398.s

real        0.1
user        0.0
sys         0.0

Linker:
        gcc -v -Xlinker +vnocompatwarnings -u PrelMain_mainIO_closure -u
PrelBase_Izh_static_info -u PrelBase_Czh_static_info -u
PrelFloat_Fzh_static_info -u PrelFloat_Dzh_static_info -u
PrelAddr_Azh_static_info -u PrelAddr_Wzh_static_info -u
PrelAddr_I64zh_static_info -u PrelAddr_W64zh_static_info -u
PrelStable_StablePtr_static_info -u PrelBase_Izh_con_info -u
PrelBase_Czh_con_info -u PrelFloat_Fzh_con_info -u PrelFloat_Dzh_con_info -u
PrelAddr_Azh_con_info -u PrelAddr_Wzh_con_info -u PrelAddr_I64zh_con_info -u
PrelAddr_W64zh_con_info -u PrelStable_StablePtr_con_info -u
PrelBase_False_closure -u PrelBase_True_closure -u
PrelPack_unpackCString_closure -u PrelException_stackOverflow_closure -u
PrelException_heapOverflow_closure -u PrelException_NonTermination_closure
-u PrelException_PutFullMVar_closure -u
PrelException_BlockedOnDeadMVar_closure -u __init_Prelude -u __init_PrelMain
-o hello Main.o -L/opt/ghc/lib/ghc-4.08.1  -lHSstd -lHSstd_cbits -lHSrts
-lgmp -lm
Reading specs from /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2/collect2 -L/lib/pa1.1
-L/usr/lib/pa1.1 -z -u main -o hello -u PrelMain_mainIO_closure -u
PrelBase_Izh_static_info -u PrelBase_Czh_static_info -u
PrelFloat_Fzh_static_info -u PrelFloat_Dzh_static_info -u
PrelAddr_Azh_static_info -u PrelAddr_Wzh_static_info -u
PrelAddr_I64zh_static_info -u PrelAddr_W64zh_static_info -u
PrelStable_StablePtr_static_info -u PrelBase_Izh_con_info -u
PrelBase_Czh_con_info -u PrelFloat_Fzh_con_info -u PrelFloat_Dzh_con_info -u
PrelAddr_Azh_con_info -u PrelAddr_Wzh_con_info -u PrelAddr_I64zh_con_info -u
PrelAddr_W64zh_con_info -u PrelStable_StablePtr_con_info -u
PrelBase_False_closure -u PrelBase_True_closure -u
PrelPack_unpackCString_closure -u PrelException_stackOverflow_closure -u
PrelException_heapOverflow_closure -u PrelException_NonTermination_closure
-u PrelException_PutFullMVar_closure -u
PrelException_BlockedOnDeadMVar_closure -u __init_Prelude -u __init_PrelMain
/usr/ccs/lib/crt0.o -L/opt/ghc/lib/ghc-4.08.1
-L/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.2 -L/usr/ccs/bin
-L/usr/ccs/lib -L/opt/gcc/lib +vnocompatwarnings Main.o -lHSstd
-lHSstd_cbits -lHSrts -lgmp -lm -lgcc -lc -lgcc

real        2.9
user        1.7
sys         0.6

rm -f /tmp/ghc17398*
$ 




More information about the Glasgow-haskell-bugs mailing list