Subject: Unaligned access in C library
To: NetBSD/Alpha <port-alpha@netbsd.org>
From: B. James Phillippe <bryan-spamtrap0@darkforest.org>
List: port-alpha
Date: 02/16/2002 18:17:20
Hello,

I am running 1.5.2 on a DEC Alpha, and have bumped into what I believe is
an unaligned access in the C library.  At least, I have an application
which blows up with "unaligned access" only when compiled with "-pg" for
profiling.  When I run the address through gbd, this is what I get:

% test/unix_util.TEST -r test/input.dump.1 tcp
pid 25891 (unix_util.TEST): unaligned access: va=0x1201aef14 pc=0x1200244d8 ra=0x120016e1c op=ldq
Segmentation fault
% gdb !:0                                                        (returned 139)
gdb test/unix_util.TEST
GNU gdb 4.17
Copyright 1998 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 "alpha--netbsd"...
(gdb) l *0x1200244d8
0x1200244d8 is in __setjmp14 (/usr/src/lib/libc/arch/alpha/gen/__setjmp14.S:67).
/usr/src/lib/libc/arch/alpha/gen/__setjmp14.S:62: No such file or directory.
(gdb) p *0x1201aef14
$1 = 0
(gdb) l *0x120016e1c
No source file for address 0x120016e1c.
(gdb)

If I pop open __setjmp14.c, line 67 contains CALL:

    /* see what's blocked */
    mov zero, a0            /* how (insignificant) */
    mov zero, a1            /* set (NULL) */
    lda a2, 648(s0)         /* point to mask in sc */
    CALL(__sigprocmask14)

Which expands to:

/*
 * CALL
 *  Function invocation
 */
#define CALL(_name_)                        \
    .loc    1 __LINE__;                 \
    jsr ra,_name_;                  \
    ldgp    gp,0(ra)


Any advice?

-bp
--
# bryan at darkforest dot org
# Software Engineer