Sorry for the late reply.

2011/9/28 Mike Hommey <m...@glandium.org>:
> On Tue, Sep 27, 2011 at 10:32:17PM +0200, Émeric Maschino wrote:
>
> Thanks so in fact the error is on the next line, and is due to this
> code:
>  inline PRBool Equals(const nsID& other) const {
>    return
>      ((PRUint64*) &m0)[0] == ((PRUint64*) &other.m0)[0] &&
>      ((PRUint64*) &m0)[1] == ((PRUint64*) &other.m0)[1];
>  }
>
> Mike

Wow! How did you figure this? From the assembly output?

I still understand what's wrong with this code. nsID is defined as:

struct nsID {
  PRUint32 m0;
  PRUint16 m1;
  PRUint16 m2;
  PRUint8 m3[8];
  ...
};

It seems 64-bit aligned to me.

And if I understand Equals code correctly, (PRUint64*)[0] is a 64-bit
word with packed data of m0, m1 and m2 (32+16+16 = 64 bits) and
(PRUint64*)[1] is another 64-bit word with m3 data (8*8 = 64 bits).

Am I right? How can this be unaligned then?

     Émeric



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to