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

Re: sparc64 breakage



On Sun, 14 Mar 2004 21:05:48 -0500
Brad <brad_(_at_)_comstyle_(_dot_)_com> wrote:

> > 3. icewm dumps core (Bus Error)
> 
> More often than not its due to an unaligned memory access. I feel that
> its a waste of time trying to track down bugs in such an ancient
> version of icewm as what we have in the ports tree now. Upgrade the
> port to the latest stable release of 1.2.13 and then see how it fares
> with OpenBSD/sparc64. Has anyone tried icewm on OpenBSD/alpha or
> OpenBSD/amd64? I would say mark the port BROKEN on sparc64 for now.

Brad,
thanks for the reply.

I tried the latest stable icewm - same problem in the same place.
Not sure whether it's a compiler, libc(floating point) or icewm issue -
icewm dumps core while executing line 162 in ypaint.cc:
           u_red   = 3UL * (d_red   * d_red);
("u_red" is declared as 'double long' and "d_red" as 'long')

Is 'double' at least 8 bytes long on all architectures? If so, than we
can declare everything as 'double' instead of 'double long' and it should
still work. Tested only on sparc64 at the moment - icewm works fine now.

--
Andrey


$OpenBSD$
--- src/ypaint.cc.orig	2004-03-18 23:34:54.000000000 -0600
+++ src/ypaint.cc	2004-03-18 23:48:08.000000000 -0600
@@ -143,11 +143,10 @@ void YColor::alloc() {
     if (Success == XAllocColor(app->display(), app->colormap(), &color))
     {
         int j, ncells;
-        double long d = 65536. * 65536. * 65536. * 24;
         XColor clr;
         unsigned long pix;
         long d_red, d_green, d_blue;
-        double long u_red, u_green, u_blue;
+        double u_red, u_green, u_blue, d1, d = 65536 * 65536 * 65536 * 24;
 
         pix = 0xFFFFFFFF;
         ncells = DisplayCells(app->display(), DefaultScreen(app->display()));
@@ -163,7 +162,7 @@ void YColor::alloc() {
             u_green = 4UL * (d_green * d_green);
             u_blue  = 2UL * (d_blue  * d_blue);
 
-            double d1 = u_red + u_blue + u_green;
+            d1 = u_red + u_blue + u_green;
 
             if (pix == 0xFFFFFFFF || d1 < d) {
                 pix = j;