Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Problems with packages on a netbsd-6 sparc



On 05/02/2012 11:07 AM, Mouse wrote:

    0x00024e24 in make_pwitem (pw=0x204a7aa8, name=0x0) at ./pwutil.c:178
    178         memcpy(newpw, pw, sizeof(struct passwd));
    (gdb) print newpw
    $1 =<optimized out>
    (gdb) print pw
    $2 = (const struct passwd *) 0x204a7aa8

It means the variable is not stored anywhere at that point, because the
optimizer determined it didn't need to exist.  Most likely it has gone
dead (in the data-flow sense), but I can imagine other possibilities.

I'm not sure why you think this means it's misaligned.  While I'm not
certain, I think sparc32 has no types requiring stricter than 8-byte
alignment, meaning 204a7aa8 is suitably aligned for anything.  Looking
at struct passwd, I don't see any types there which I would expect to
be wider than 8 bytes, though, admittedly, I'm not looking at the -6
<pwd.h>.

  Oh, I guessed it was an alignment issue just because I've seen that so
many times on sparc's.  And, it's not pw I was worried about the alignment
of, it was newpw.

  Through some printf debugging, I confirmed that when optimized, newpw
was at a 4-byte alignment.  It was a pointer that was offset from a malloc'd
block by sizeof(cache_item), a struct earlier in the same source file.
But interestingly, when not optimized, newpw is also at the same 4-byte
alignment, and the memcpy *doesn't* cause a SIGBUS.  That surprised me.

                       - Chris



Home | Main Index | Thread Index | Old Index