Gabor Gombas wrote:

>> Program terminated with signal 10, Bus error.
>> #0  0x0000000100011e04 in mailbox_write_index_header
>> (mailbox=0xffffffff7fff3f70) at mailbox.c:1319
>> 1319        *((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) =
>> htonll(mailbox->highestmodseq);
> 
> Could you do a "p &buf" here? My guess would be that it is not 8-byte
> aligned (because nobody told the compiler that it should be), and
> therefore the code above generates an unaligned access, which explains
> the bus error perfectly.

Program terminated with signal 10, Bus error.
#0  0x0000000100011e04 in mailbox_write_index_header
(mailbox=0xffffffff7fff3f70)
    at mailbox.c:1319
1319        *((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) =
htonll(mailbox->highestmodseq);
(gdb) p &buf
$1 = (char (*)[96]) 0xffffffff7fff3da0

> You can also try to replace
> 
>       char buf[INDEX_HEADER_SIZE];
> 
> with
> 
>       union {
>               char buf[INDEX_HEADER_SIZE];
>       #ifdef HAVE_LONG_LONG_INT
>               long long int dummy;
>       #endif
>       } u;
> 
> to force the required alignment, and also replace every reference to
> "buf" with "u.buf" inside the function. You may also use an unnamed
> union and avoid the u.buf replaces if the Sun compiler supports unnamed
> unions.

#0  0x0000000100011dec in mailbox_write_index_header
(mailbox=0xffffffff7fff3f60)
    at mailbox.c:1322
1322        *((bit64 *)(u.buf+OFFSET_HIGHESTMODSEQ_64)) =
htonll(mailbox->highestmodseq);
(gdb) p &u.buf
$1 = (char (*)[96]) 0xffffffff7fff3d90

Thanks a lot!

-- 
Alex Deiter
----
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

Reply via email to