Re: [PATCH] fix crashing on amd64



Ross McFarland wrote:
On 1/11/06, Thierry Vignaud <tvignaud mandriva com> wrote:
we'd experienced application crash on x86_64 for quite some time. it's
quite reproductable with 1.11x branch. perl loops while trying to segfaulting.

Patch from Rafael Garcia-Suarez <rgarciasuarez mandriva com> traced it
and fixed it:

On x86_64, the conversions from ptr to int and from int to ptr will
loose the highest bits of the pointer, leading to memory access
violations. Use the safer macros that perl provides instead.

if those macros are not working it would likely be a bug in glib
rather than gtk2-perl. what version of glib are you all seeing
problems with?

There is possibly a bug in glib (2.8.5 and previous versions)
and indeed the macros defined in /usr/lib/glib-2.0/include/glibconfig.h
on an x86_64 architecture won't indeed work.

However, our in-house Gtk/Gnome hacker tells me that those macros
are not really intended to be used like that, because their
purpose is to store ints into void*. A problem that perl does
not have, because it's guaranteed by construct that an IV can hold
a pointer.

The macros I proposed to use instead come directly from perl.h
and are designed for that, and moreover are tested on a sufficiently
large number of architectures to be confident in their safety.
They are documented (in perlguts, section "Pointer-To-Integer
and Integer-To-Pointer") and supported, so I think it's the
right thing to do here. (Note that they're already used elsewhere
in GObject.xs).



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]