[PATCH] fix KJS crash on some more strict platforms

Maks Orlovich mo002j at mail.rochester.edu
Wed Dec 17 00:04:19 GMT 2003

On Tuesday 16 December 2003 06:53 pm, Helge Deller wrote:
> On Wednesday 17 December 2003 00:41, Helge Deller wrote:
> >So, the code above will work as expected. However, this code might not:
> >....[example stripped]
> > And this is exactly what my proposed patch is about. We try to read a
> > double from the pointer which is &char[8] and this is not guaranteed to
> > work: const double NaN = *(const double*) NaN_Bytes;
> .... at least since NaN_Bytes (remember, it's not in a union right now!) is
> not guaranteed to have been 8-byte aligned by the compiler which a
> double needs to be on e.g. the hppa platform. (As another example I think
> e.g. IA64 would not crash but might introduce extra wait/load cycles)
> As the manpage says: It might work, but does not need to.

Oh, I am not disagreeing w/any that. The point I am trying to make is that 
using the union to initialize is a perfectly good way, and fully consistent 
w/aliasing rules to the best of my knowledge

More information about the kde-core-devel mailing list