Optimization and GCC?

Till Doerges till@doerges.net
Wed, 19 Dec 2001 09:56:36 +0100

Hello everybody,

I've got some trouble compiling haskell-code on a sparc system. As
soon as I use the option '-O', ghc starts spilling messages like

--- snip ---
/u/joe/built/lib/ghc-5.00.2/includes/Regs.h:255: warning: call-clobbered register used for global register variable 
/tmp/ghc15733.hc:5391: warning: deprecated initialization of zero-length array
/tmp/ghc15733.hc:5391: warning: (near initialization for `Main_main_closure.payload')
--- snap ---

The 2nd type occurs way more often, but it doesn't look really
bad. What I'm more worried about is the first. To use an already used
register? Perhaps anyone could explain these messages to me?
It seems, however, that the code produced is okay.

Things get worse, if I try to use gcc for code-generation. The
messages *seem* to remain the same. Invocation of ghc is basically the
same as above, w/ '-fvia-C -O2-for-C' added:

--- snip ---
mai00dqr@userv1:~/Diplom/cls/src> make
/u/joe/built/bin/ghc-5.00.2 -O -fvia-C -O2-for-C -cpp -DBEGIN_GHC_ONLY='-}' -DEND_GHC_ONLY='{-' -DBEGIN_HUGS_ONLY='{-' -DEND_HUGS_ONLY='-}' -package text -package util -i../lib/parsec-250101 -i/u/joe/built/lib/ghc-5.00.2/imports -lncurses --make Main -o cls
ghc-5.00.2: chasing modules from: Main
--- snap ---

The code generated now definitely is not okay:

--- snip ---
mai00dqr@userv1:~/Diplom/cls/src> ./cls
Segmentation Fault
--- snap ---

Here's what I'm using:

--- snip ---
mai00dqr@userv1:~> gcc --version
mai00dqr@userv1:~> uname -a
SunOS userv1 5.8 Generic_108528-12 sun4u sparc SUNW,Ultra-80
--- snap ---

Is the segmentation fault perhaps related to an interoperability
between ghc and the latest gcc-versions? On a Linux-machine using the
same ghc-version but gcc-2.96 '-O -fvia-C -O2-for-C' doesn't cause
any problems (neither does it cause any messages like the above ones).

If it is a problem related to the version of gcc, how do I tell ghc
which version to use? I only know how to do that on the commandline.

Any hints would be greatly appreciated.

Bye -- Till
     e-mail: reverse(net dot doerges at till)   | ENCRYPTED |
    pgp/gpg: keys via keyserver or my homepage  |  MAIL IS  |
        www: http://www.doerges.net             |  WELCOME! |