From 6d650c60d563b98edcf2612bec850c547f64fdbf Mon Sep 17 00:00:00 2001 From: dsainty Date: Mon, 16 Aug 2004 12:36:38 +0000 Subject: Building POSE under gcc 3.3.3 with optimisation as default (g++ -O2) leads to a malfunction where POSE will go into an apparent infinite loop after the first pen operation. This patch codes around the problem. --- emulators/palmosemulator/patches/patch-an | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 emulators/palmosemulator/patches/patch-an (limited to 'emulators') diff --git a/emulators/palmosemulator/patches/patch-an b/emulators/palmosemulator/patches/patch-an new file mode 100644 index 00000000000..a12161fb9a8 --- /dev/null +++ b/emulators/palmosemulator/patches/patch-an @@ -0,0 +1,35 @@ +$NetBSD: patch-an,v 1.1 2004/08/16 12:36:38 dsainty Exp $ + +Building POSE under gcc 3.3.3 with optimisation as default (g++ -O2) leads to +a malfunction where POSE will go into an apparent infinite loop after the +first pen operation. + +This appears to be due to pointer coordinate corruption, fixed by the patch +below. + +The only user of the patched type coercion is +SrcShared/Patches/EmPatchMgr.cpp, which says: + +PointType palmPen = pen; + +I haven't entirely traced this through, but I suspect that the palmPen +coordinates are corrupted on the "pen up" event, leading the hosted Palm OS to +believe the stylus is being perpetually dragged around the screen. + +The issue appears to be resolved by the below patch, which is a somewhat less +dodgy (but only just!) implementation, and appears to be enough to convince +the compiler to keep the target class uncorrupted. + +Another option is: EmPatchMgr.cpp: PointType palmPen = { pen.fX, pen.fY }; + +--- SrcShared/EmPoint.cpp.orig 2002-03-30 01:11:14.000000000 +1200 ++++ SrcShared/EmPoint.cpp 2004-08-16 00:11:31.000000000 +1200 +@@ -233,7 +233,7 @@ + #undef FOR_POINT + #define FOR_POINT(cls, size, x, y) \ + EmPoint::operator cls() const \ +- { size pt[2]; pt[x] = fX; pt[y] = fY; return *(cls*) pt; } ++ { union { size pt[2]; cls bar; } foo; foo.pt[x] = fX; foo.pt[y] = fY; return foo.bar; } + + POINT_LIST_XY_LONG + POINT_LIST_YX_LONG -- cgit v1.2.3