hpux 11.0 floating point alignment problem in PrimOps.cmm

Joe Buehler aspam at cox.net
Tue Jun 26 08:20:42 EDT 2007

I am getting a floating point alignment exception
during a GHC 6.4.2 bootstrap on hpux 11.0 -- the
stage 1 ghc core dumps.  The stack trace looks like this:

(gdb) where
#0  0x1ac0df8 in __gmpn_mul_1 ()
#1  0x1abdd24 in __gmpz_mul ()
#2  0x1aa2ef4 in timesIntegerzh_fast ()
#3  0x1ab8124 in StgRun ()
#4  0x1a9bc08 in schedule ()
#5  0x1a9c5f4 in waitThread_ ()
#6  0x1a9c52c in scheduleWaitThread ()
#7  0x1a99a88 in rts_evalLazyIO ()
#8  0x1a990dc in main ()

The timesIntegerzh_fast routine is calling into libgmp,
libgmp is then core dumping because of an access to a double
with bad alignment -- it is trying to load a double from
a 4-byte aligned address -- hpux requires 8 byte alignment.

The code for timesIntegerzh_fast comes from PrimOps.cmm.
It is making use of these memory locations:

section "bss" {
    bits8 [SIZEOF_MP_INT];

section "bss" {
    bits8 [SIZEOF_MP_INT];

section "bss" {
    bits8 [SIZEOF_MP_INT];

section "bss" {
    bits8 [SIZEOF_MP_INT];

Might this alignment problem be fixed by adding in
some "align 8" statements?

Joe Buehler

More information about the Glasgow-haskell-users mailing list