Segmentation fault during build of 5.04.3

Ed Osinski osinski at cs.nyu.edu
Fri Apr 18 12:53:46 EDT 2003


On Fri, Apr 18, 2003 at 10:11:57AM +0100, Simon Marlow wrote:
>  
> > Ok, it took me a while to figure out how to write a _complete_ simple
> > program; I haven't written anything in Haskell before and was
> > installing ghc because I decided to take the plunge.  The simplest
> > program works fine:
> > 
> > ------------------------------
> > module Main
> >     where
> > 
> > main = putStrLn "Hello, world"
> > ------------------------------
> > 
> > $ ghc --make Main.hs -o Test
> > ghc-5.04.2: chasing modules from: Main.hs
> > Skipping  Main             ( Main.hs, ./Main.o )
> > ghc: linking ...
> > $ ./Test
> > Hello, world
> > 
> > There still might be wrong with the 5.04.2 installation, but it's not
> > clear to me what it could be.  I previously had a ghc-4.04
> > installation, and saw that the installation of 5.04.2 didn't overwrite
> > the link from /usr/local/bin/ghc.  I noticed and fixed this before
> > reporting my problem.  I've since removed all the remnants of the old
> > ghc, as far as I can tell, with no luck.
> 
> Ok, I'm a bit stumped now, but there are some other things we can try.
> 
> - Can you run the hello world example from inside GHCi using your
>   installed 5.04.2?  (type 'ghci Main.hs' and then 'main').

Yes, it works fine:

$ ghci Main.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 5.04.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Loading package haskell98 ... linking ... done.
Compiling Main             ( Main.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Hello, world
*Main> 

> - Start up GHCi with a few packages: 'ghci -package util -package
>   text' just to make sure it can find all its libraries.

Also fine:

$ ghci -package util -package text
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 5.04.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package lang ... linking ... done.
Loading package concurrent ... linking ... done.
Loading package posix ... linking ... done.
Loading package util ... linking ... done.
Loading package text ... linking ... done.
Prelude> 

> - go into ghc/utils/genprimopcode in the source tree, and try to
>   find out why genprimopcode is crashing.  First, do './genprimopcode
>   +RTS -Sstderr' and see if you get any output.  Try gdb on it, 
>   and see if you get any useful information out of that.

Well, it doesn't segfault immediately, but I'm not sure how useful the
information is:

# gdb ./genprimopcode
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.8"...
(gdb) run +RTS -Sstderr -RTS --data-decl < ../../compiler/prelude/primops.txt
Starting program: /systems/sware/src/build/ghc-5.04.3-build/ghc/utils/genprimopcode/genprimopcode +RTS -Sstderr -RTS --data-decl < ../../compiler/prelude/primops.txt
genprimopcode --data-decl +RTS -Sstderr 
    Alloc    Collect    Live    GC    GC     TOT     TOT  Page Flts
    bytes     bytes     bytes  user  elap    user    elap
   268280    262144      8656  0.01  0.01    0.05    0.02    0    0  (Gen:  1)
   262140    270336     28724  0.01  0.01    0.06    0.03    0    0  (Gen:  0)
   262128    282624     43852  0.00  0.00    0.06    0.03    0    0  (Gen:  0)
   262128    282624     89240  0.00  0.00    0.06    0.04    0    0  (Gen:  0)
   262128    299008    129748  0.01  0.01    0.08    0.06    0    0  (Gen:  0)
   262132    290816    156524  0.00  0.01    0.08    0.07    0    0  (Gen:  0)
   262128    270336    181456  0.00  0.00    0.09    0.08    0    0  (Gen:  0)
   262128    290816    208520  0.00  0.00    0.10    0.09    0    0  (Gen:  0)
   262140    290816    228036  0.00  0.00    0.11    0.10    0    0  (Gen:  0)
   262144    274432    251400  0.00  0.00    0.12    0.12    0    0  (Gen:  0)
   262144    274432    273540  0.00  0.00    0.13    0.13    0    0  (Gen:  0)
   262084    274432    296216  0.00  0.00    0.14    0.14    0    0  (Gen:  0)
   262132    274432    317468  0.01  0.01    0.16    0.16    0    0  (Gen:  0)
   262092    274432    345204  0.00  0.00    0.17    0.17    0    0  (Gen:  0)
   262112    278528    370320  0.00  0.00    0.18    0.18    0    0  (Gen:  0)
   262140    278528    393156  0.00  0.00    0.19    0.19    0    0  (Gen:  0)
   262132    274432    418684  0.01  0.01    0.20    0.21    0    0  (Gen:  0)
   262144    278528    429728  0.00  0.00    0.21    0.22    0    0  (Gen:  0)
   262136    274432    450316  0.00  0.00    0.22    0.23    0    0  (Gen:  0)
   262116    274432    469788  0.00  0.00    0.24    0.25    0    0  (Gen:  0)
   262132    270336    488380  0.00  0.00    0.25    0.26    0    0  (Gen:  0)
   262132    270336    507540  0.01  0.01    0.27    0.28    0    0  (Gen:  0)
   262128    270336    528716  0.00  0.00    0.28    0.29    0    0  (Gen:  0)
   262140    286720    537144  0.00  0.00    0.29    0.30    0    0  (Gen:  0)
   262128    270336    554628  0.00  0.00    0.30    0.31    0    0  (Gen:  0)
   262128    270336    576200  0.00  0.00    0.31    0.33    0    0  (Gen:  0)
   262124    274432    602036  0.00  0.00    0.32    0.34    0    0  (Gen:  0)
   262128    278528    620744  0.00  0.00    0.33    0.35    0    0  (Gen:  0)
   262120    282624    656844  0.00  0.00    0.34    0.36    0    0  (Gen:  0)
   262128    282624    676180  0.00  0.00    0.35    0.37    0    0  (Gen:  0)
   262144    282624    707328  0.00  0.00    0.36    0.39    0    0  (Gen:  0)
   262128    274432    732088  0.00  0.00    0.37    0.40    0    0  (Gen:  0)
   262128    278528    747276  0.00  0.00    0.39    0.42    0    0  (Gen:  0)
   262140    278528    767772  0.00  0.01    0.40    0.44    0    0  (Gen:  0)
   262136    274432    788352  0.00  0.00    0.41    0.45    0    0  (Gen:  0)
   262144    274432    809224  0.00  0.00    0.43    0.47    0    0  (Gen:  0)
   262128    274432    832948  0.00  0.00    0.44    0.48    0    0  (Gen:  0)
   262140    274432    858500  0.00  0.00    0.45    0.49    0    0  (Gen:  0)
   262136    278528    883040  0.00  0.00    0.46    0.51    0    0  (Gen:  0)
   262140    278528    907556  0.01  0.01    0.48    0.53    0    0  (Gen:  0)
   262124    278528    930600  0.00  0.00    0.49    0.54    0    0  (Gen:  0)
   262132    274432    952436  0.01  0.01    0.51    0.56    0    0  (Gen:  0)
   262124    274432    962032  0.00  0.00    0.52    0.57    0    0  (Gen:  0)
   262120    274432    982444  0.00  0.00    0.54    0.59    0    0  (Gen:  0)
   262144    274432   1003500  0.00  0.00    0.55    0.60    0    0  (Gen:  0)
   262108    274432   1028324  0.01  0.01    0.57    0.62    0    0  (Gen:  0)
   262096    278528   1053232  0.00  0.00    0.58    0.63    0    0  (Gen:  0)
   262136    278528   1076716  0.01  0.01    0.60    0.65    0    0  (Gen:  0)
   262144   1343488    569292  0.03  0.04    0.63    0.69    0    0  (Gen:  1)
   262132    278528    580664  0.01  0.01    0.65    0.71    0    0  (Gen:  0)
   262140    282624    598716  0.00  0.00    0.66    0.72    0    0  (Gen:  0)
   262136    286720    622168  0.00  0.00    0.67    0.73    0    0  (Gen:  0)
   262080    274432    632256  0.00  0.00    0.68    0.74    0    0  (Gen:  0)
   262144    274432    655764  0.01  0.01    0.70    0.76    0    0  (Gen:  0)
   262104    274432    676172  0.00  0.00    0.71    0.77    0    0  (Gen:  0)
   266232    274432    699836  0.00  0.00    0.72    0.78    0    0  (Gen:  0)
   262124    274432    722896  0.00  0.00    0.73    0.79    0    0  (Gen:  0)
   262128    274432    738800  0.00  0.00    0.74    0.81    0    0  (Gen:  0)
   262128    282624    761900  0.00  0.00    0.75    0.82    0    0  (Gen:  0)
   262144    270336    771700  0.00  0.00    0.76    0.83    0    0  (Gen:  0)
   262120    274432    791572  0.00  0.00    0.77    0.84    0    0  (Gen:  0)
   262112    274432    817620  0.00  0.00    0.78    0.85    0    0  (Gen:  0)

Program received signal SIGSEGV, Segmentation fault.
0x000ba500 in stg_PAP_info ()
(gdb) bt
#0  0x000ba500 in stg_PAP_info ()
#1  0x000ba624 in __stg_update_PAP ()
#2  0x000ae67c in schedule ()
#3  0x000aef6c in waitThread_ ()
#4  0x000aef58 in waitThread ()
#5  0x000ad810 in rts_mainEvalIO ()
#6  0x000ad274 in main ()
(gdb) 

Another couple of data points:

* I'm using gcc 3.2.2 (which I've built lots of other software with
  successfully).

* Earlier during the "make all" for 5.04.3, there are the following warnings:

gcc -O    -c mkNativeHdr.c -o mkNativeHdr.o
In file included from Stg.h:182,
                 from mkNativeHdr.c:10:
Regs.h:245: warning: call-clobbered register used for global register variable
Regs.h:251: warning: call-clobbered register used for global register variable
Regs.h:257: warning: call-clobbered register used for global register variable
Regs.h:263: warning: call-clobbered register used for global register variable
Regs.h:269: warning: call-clobbered register used for global register variable
Regs.h:269: warning: call-clobbered register used for global register variable
Regs.h:275: warning: call-clobbered register used for global register variable
Regs.h:275: warning: call-clobbered register used for global register variable

I can't think of anything else.

- Ed


> 
> Cheers,
> 	Simon
> _______________________________________________
> Glasgow-haskell-bugs mailing list
> Glasgow-haskell-bugs at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



More information about the Glasgow-haskell-bugs mailing list